在Linux上,是否可以作为另一个用户进行一次性登录,覆盖其默认she
发布时间:2020-12-14 02:34:42 所属栏目:Linux 来源:网络整理
导读:作为root用户,我想以服务用户身份登录(jenkins – CI服务器)并使用其用户,组和umask设置操作文件. 通常我会(作为根)做sudo -i -u jenkins,甚至su-jenkins.但是jenkins的默认shell是/ bin / false,它会立即退出. 有没有办法以Jenkins身份登录,但指定使用不同
作为root用户,我想以服务用户身份登录(jenkins – CI服务器)并使用其用户,组和umask设置操作文件.
通常我会(作为根)做sudo -i -u jenkins,甚至su-jenkins.但是jenkins的默认shell是/ bin / false,它会立即退出. 有没有办法以Jenkins身份登录,但指定使用不同的shell?我真的必须在/ etc / passwd /中更改jenkins的shell吗? 解决方法
su on
linux支持使用–shell选项设置shell
su jenkins --shell=/bin/bash 你需要以root身份su才能工作.从手册页: If the target user has a restricted shell (i.e. the shell field of this users entry in /etc/passwd is not listed in /etc/shell),then the --shell option or the $SHELL environment variable wont be taken into account,unless su is called by root. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |