Git Server-限制Git用户使用SSH登陆操作
在前面的文章中(),为大家介绍了如何自己架设一个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.
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/server/fwq/8900.shtml
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
使用Cockpit方便地管理容器
时间:2020-12-29
-
linux系统上如何快速安装
时间:2020-12-29
-
如何在Linux VPS上定制自己
时间:2020-12-29
-
开启nginx和php-fpm的status状
时间:2020-12-29
-
采用DNSPOD解析API快速验证
时间:2020-12-29
-
如何在CentOS 7上安装Elast
时间:2020-12-29
-
.Net Core在Linux服务器上部署
时间:2020-12-29
-
如何用树莓派控制GOIO引脚
时间:2020-12-25
热门文章
-
利用可道云KodExplorer软件部署私有云盘和
时间:2020-12-22
-
Linux VPS/服务器一键检测硬件配置、节点下
时间:2020-12-22
-
采用DNSPOD解析API快速验证域名快速安装免
时间:2020-12-29
-
Linux系统下用iperf诊断网络端口是否有被过
时间:2020-12-22
-
在CentOS系统上安装GitLab并自定义域名访问
时间:2020-12-23
-
web3通过testrpc访问以太坊数据入门
时间:2020-12-24
-
容器环境中的代理模型
时间:2020-12-22
-
在linux下启动tomcat,并实时查看tomcat的控
时间:2020-12-23
-
使用Linux定时脚本更新服务器的git代码
时间:2020-12-24
-
.Net Core在Linux服务器上部署.NET框架教程
时间:2020-12-29
