免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2078 | 回复: 5
打印 上一主题 下一主题

SSH 限制登入 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-08-27 09:13 |只看该作者 |倒序浏览
有台LIUNX服务器,需要开放SFTP与外界进行数据交换,我想某个帐号只限制与SFTP的命令,而不想让其SSH登入,不知道如何实现????

论坛徽章:
0
2 [报告]
发表于 2010-08-27 09:50 |只看该作者
usermod -s /sbin/nologin username

论坛徽章:
0
3 [报告]
发表于 2010-08-27 10:32 |只看该作者
usermod -s /sbin/nologin username

好象SCP也不可以使用了,有没有别的办法

论坛徽章:
0
4 [报告]
发表于 2010-08-27 13:55 |只看该作者
本帖最后由 jayliud 于 2010-08-27 13:58 编辑

LZ的意思要配置/etc/hosts.deny,/etc/ssh/sshd_config?

论坛徽章:
0
5 [报告]
发表于 2010-08-27 14:33 |只看该作者
tcp wrapper不能对用户进行限制

论坛徽章:
0
6 [报告]
发表于 2010-08-27 17:03 |只看该作者
How to restrict users to SFTP only instead of SSH

Posted by hruske on Sun 13 Feb 2005 at 21:52
Tags: sftp, ssh

Sometimes you want to have users, that have access to files on your server, but don't want them to be able to log in and execute commands on your server.

This is done quite easily.

Add user as usually and assign him a password. Then run the following command (replace the 'username' with real user name):
root@host # usermod -s /usr/lib/sftp-server username

This changes user's shell to sftp-server.

The last step for this to work is to add '/usr/lib/sftp-server' to /etc/shells to make it a valid shell, eg. like this:
root@host # echo '/usr/lib/stfp-server' >> /etc/shells

There. Now you've setup a user who can only access your server with SFTP.

我自己改user默认shell就可以工作了,sftp-server的位置查看sshd_config就可以了
[user@~ (0)]$ finger sftponly
Login: sftponly                         Name: (null)
Directory: /home/sftponly               Shell: /usr/libexec/openssh/sftp-server
Never logged in.
No mail.
No Plan.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP