首页 > 解决方案 > 如何在ubuntu上使用其环境登录另一个用户

问题描述

在 Ubuntu 上,当我打开终端时,它是通过我自己的用户登录的。我想以用户“jenkins”登录并使用它自己的环境设置,即主目录等。另外,我没有“jenkins”的密码,所以所有的“su”解决方案都不适合我。

标签: ubuntujenkinssudo

解决方案


su is short for switch user.

With su jenkins you become user jenkins, but don't execute his profile scripts.
Calling su - jenkins or su -l jenkins does the same, but also executes his profile scripts.

See also the su manpage.

In case you don't have the password for user jenkins (or don't want to login with password), but are allowed to call "sudo" you can also add "sudo" in front of the su (i.e. sudo su - jenkins )


推荐阅读