Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何限制UNIX服务器上的某些用户仅访问GIT命令?_Git_Shell_Unix_Ssh - Fatal编程技术网

如何限制UNIX服务器上的某些用户仅访问GIT命令?

如何限制UNIX服务器上的某些用户仅访问GIT命令?,git,shell,unix,ssh,Git,Shell,Unix,Ssh,如何限制UNIX服务器上的用户仅访问GIT命令?我希望用户只能使用服务器从我放在服务器中的git存储库中推/克隆/拉,但我不希望他们能够在创建一组用户时使用ssh或ftp到服务器。使用chgrp命令将/opt/apps/start组更改为特定组: # chgrp {groupName} {/path/to/command} 范例 # chgrp newgroup /opt/apps/start # chmod 750 /opt/apps/start 禁用其他人的文件权限 最后,使用chmo

如何限制UNIX服务器上的用户仅访问GIT命令?我希望用户只能使用服务器从我放在服务器中的git存储库中推/克隆/拉,但我不希望他们能够在创建一组用户时使用ssh或ftp到服务器。使用chgrp命令将/opt/apps/start组更改为特定组:

# chgrp {groupName} {/path/to/command}
范例

# chgrp newgroup /opt/apps/start
# chmod 750 /opt/apps/start
禁用其他人的文件权限

最后,使用chmod命令更改文件权限,如下所示:

# chmod 750 /path/to/command
范例

# chgrp newgroup /opt/apps/start
# chmod 750 /opt/apps/start
您还可以对目录应用权限(这将禁用对其他目录的命令访问):

测试

su到usr1,输入:

# su - usr1
$ id
$ /opt/apps/start
$ exit
su至usr2(非appsonly集团成员),输入:

示例输出:


有关更多详细信息,请参阅下面的链接

将他们的登录shell设置为
/usr/bin/git shell

sudo chsh -s /usr/bin/git-shell <username>
sudo chsh-s/usr/bin/git shell
有关更多详细信息,请参阅

sudo chsh -s /usr/bin/git-shell <username>