作为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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。