【问题标题】:How to restrict some user on UNIX server for only accessing GIT command?如何限制 UNIX 服务器上的某些用户只能访问 GIT 命令?
【发布时间】:2014-02-22 08:44:33
【问题描述】:

如何限制 UNIX 服务器上的用户只能访问 GIT 命令?我希望用户只能使用服务器从我放在服务器中的 git 存储库中推送/克隆/拉取,但我不希望他们能够 ssh 或 ftp 到服务器

【问题讨论】:

标签: git shell unix ssh


【解决方案1】:

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

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

更多详情请见http://git-scm.com/book/ch4-4.html

【讨论】:

    【解决方案2】:

    当创建了一组用户时。使用 chgrp 命令将 /opt/apps/start 的组更改为特定组:

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

    例子

    # chgrp newgroup /opt/apps/start
    

    禁用其他人的文件权限

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

    # chmod 750 /path/to/command
    

    例子

    # chmod 750 /opt/apps/start
    

    您还可以对目录应用权限(这将禁用其他人的命令访问权限):

    # chgrp appsonly /opt/apps
    # chmod 0640 /opt/apps
    

    测试

    su到usr1,输入:

    # su - usr1
    $ id
    $ /opt/apps/start
    $ exit
    

    su到usr2(不是appsonly组的成员),输入:

    # su - usr2
    $ id
    $ /opt/apps/start
    

    示例输出:

    bash: /opt/apps/start: Permission denied
    

    更多详情请参考以下链接....Here

    【讨论】:

      猜你喜欢
      • 2014-08-26
      • 2016-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多