内容简介:这两天在研究gitlab,在安装gitlab的时候,系统会自动创建一个git用户,当我使用su git切换到git用户的时候发现,无法使用shell命名并且只能看到sh-4.2$,原因是因为git用户目录下缺少用户配置文件解决:
这两天在研究gitlab,在安装gitlab的时候,系统会自动创建一个git用户,当我使用su git切换到git用户的时候发现,无法使用 shell 命名并且只能看到sh-4.2$,原因是因为git用户目录下缺少用户配置文件
解决:
1:找到git用户下用户目录地址
su git cd ~ pwd
2:将 /etc/skel/目录下的文件复制到git用户目录下,并将文件访问权限改成git用户
su root cd /etc/skel/ cp .bash_logout .bash_profile .bashrc /var/opt/gitlab/ cd /var/opt/gitlab/ chown git:git .bash_logout .bash_profile .bashrc #这里注意不要将用户目录下所有文件改成git用户,这样可能会出现其他问题
3:让git用户可以执行shell命令
usermod -s /bin/bash git
这时候切换到git用户就可以使用shell命令并且显示正常
以上所述就是小编给大家介绍的《linux下使用su切换到其他用户下只能看到sh-4.2$解决》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The Sovereign Individual
James Dale Davidson、William Rees-Mogg / Free Press / 1999-08-26 / USD 16.00
Two renowned investment advisors and authors of the bestseller The Great Reckoning bring to light both currents of disaster and the potential for prosperity and renewal in the face of radical changes ......一起来看看 《The Sovereign Individual》 这本书的介绍吧!