我需要更新/usr/local/apache/confpath中的httpd.conf 。
我在cPanel中生成了SSH密钥,并在SSH / Authentication部分的Advanced options中select了它。
另外我也尝试了两个不同的SCP / Shell选项(默认是/bin/bash , sudo su - )
而当我档案协议我selectSCP。
而且我可以login,但是我得到权限被拒绝的消息,我不能编辑或下载文件。 我也试图设置777文件夹和664文件,但它也不让我做这个改变。
我正在使用Centos 6.5。
会话日志:
2014-01-06 08:23:13.128 Using SCP protocol. . 2014-01-06 08:23:13.128 Doing startup conversation with host. . 2014-01-06 08:23:13.182 Skipping host startup message (if any). ! 2014-01-06 08:23:13.182 stdin: is not a tty ! 2014-01-06 08:23:13.182 sudo: sorry, you must have a tty to run sudo . 2014-01-06 08:23:13.182 Server sent command exit status 1 . 2014-01-06 08:23:13.182 Disconnected: All channels closed * 2014-01-06 08:23:13.241 (EFatal) **Connection has been unexpectedly closed.** Server sent command exit status 1. * 2014-01-06 08:23:13.241 Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).
我想分享我的解决scheme,因为我也在search几个解决方法。 我现在正在使用CentOS7并尝试通过WinSCP(Pubkey Auth)获得连接。
sshd_config中
.. RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys PasswordAuthentication no UsePAM yes ..
@CentOS visudo – 添加以下2个主题
username ALL=NOPASSWD: /bin/su Defaults:username !requiretty
WinSCP设置:
Disable keyboard-interactive @ SSH authentication settings solves the problem for me. SCP settings command: sudo su -
正如@pragnesh所build议的,你会发现在WinSCP的所有说明常见问题如何更改用户login后(例如su根)?
不仅需要将sudo -s shell和yourusername ALL=NOPASSWD: ALL行(或类似)添加到sudoers ,还需要确保sudo不需要TTY。
虽然这是默认行为,但您可能会对其进行不同的configuration。 确保从sudoers文件中删除了requiretty选项。
你也可以改变这只有每个用户,请参阅sudoers:如何禁用每个用户的requiretty 。
您需要使用WinSCPlogin设置使用sudo
检查这个WinSCP常见问题 。