Git Server - 限制 Git 用户使用SSH登陆操作
2017-06-09 10:12
405 查看
在前面的文章中,为大家介绍了如何自己架设一个
那么如果我们想限制
我们看到,首先需要找到
接下来,我们就可以把默认的
现在,
git服务器并建立一个名为
git的用户来进行所有的
git操作。
那么如果我们想限制
git用户,禁止其进行
SSH登陆进行操作,我们可以将
git用户的
shell换成
git-shell这个工具:
$ cat /etc/shells # see if `git-shell` is already in there. If not... $ which git-shell # make sure git-shell is installed on your system. $ sudo vim /etc/shells # and add the path to git-shell from last command
我们看到,首先需要找到
git-shell的安装位置,如果没有被添加在/etc/shells中,我们需要手动将其添加进去(通常
git-shell在
/usr/bin/git-shell中)。
接下来,我们就可以把默认的
shell替换成
git-shell了:
$ sudo chsh git -s $(which git-shell)
现在,
git用户只能使用
SSH连接来进行
push和
pull,而不能用来登陆服务器了。
$ ssh git@gitserver fatal: Interactive git shell is not enabled. hint: ~/git-shell-commands should exist and have read and execute access. Connection to gitserver closed.
相关文章推荐
- Linux 限制用户使用ssh和tty登陆
- 限制用户通过ssh密钥进行认证登陆
- git的ssh配置,包括多个git server配置ssh config,使用多个ssh identify
- wi7下面配置 git bash使用ssh公钥/私钥登陆centos
- Git使用之基于SSH的Gitserver的client配置(下篇)
- 使用数据库统一管理ssh登陆用户密钥信息
- ORACLE DBA学习笔记--使用LOGON TRIGGER限制用户登陆
- linux远程ssh登陆用户的操作记录
- Ubuntu开启ssh使用root用户登陆
- Linux 上如何创建新的用户,并让其在首次登陆后修改密码,并限制其允许使用的磁盘空间
- Git使用之搭建基于SSH的Gitserver(上篇)
- 禁止部分用户使用ssh登陆
- 使用邮件监控ssh登陆用户shell脚本
- linux限制ssh用户使用命令
- 使用[登陆到]與[脚本]實現限制域用户的并发登陆
- Linux搭建使用SSH共享存取的 Git Server
- ssh的用户登陆限制
- Centos 限制root帐户登陆ssh并配置指定帐户可以使用sudo命令
- 使用数据库统一管理ssh登陆用户密钥信息
- ssh 使用root用户直接登陆