当前位置:网站首页 / Linux / 正文

WinSCP普通用户登录sftp切换到root权限

时间:2017年06月20日 | 作者 : liuhui | 分类 : Linux | 浏览: 9334次 | 评论 0

阿里云限量代金券 | 此广告位出租25元/月

一般服务器为安全禁止ssh下root账号登录,此时使用sftp登录管理服务器只能使用普通账号登录,给管理带来诸多不便,可以设置为特定普通SSH用户添加sudo权限,登录到sftp时可sudo切换到root权限下。

查看sftp-server执行文件目录:

cat /etc/ssh/sshd_config|grep sftp

Subsystem    sftp    /usr/libexec/openssh/sftp-server

编辑/etc/sudoers为特定用户添加执行sftp sudo权限:

#http://www.haiyun.me

user ALL=NOPASSWD:  /usr/libexec/openssh/sftp-server

后续如果登录失败日记显示:

sorry, you must have a tty to run sudo ; TTY=unknown

需在/etc/sudoers内注释此行:

#Defaults    requiretty  

sftp客户端设置登录以sudo权限执行sftp,下图以winscp为例:

sudo /usr/libexec/openssh/sftp-server

1.png

此时用winscp登录就是root权限了,对整个系统的文件都拥有生杀大权。。。


原文转自 海运博客

原文链接:http://www.haiyun.me/archives/winscp-sftp-sudo-root.html


推荐您阅读更多有关于“”的文章

猜你喜欢

网站分类
关注电脑博士
友情链接

分享:

支付宝

微信