ubuntu - 如何在ubuntu上使用其环境登录另一个用户
问题描述
在 Ubuntu 上,当我打开终端时,它是通过我自己的用户登录的。我想以用户“jenkins”登录并使用它自己的环境设置,即主目录等。另外,我没有“jenkins”的密码,所以所有的“su”解决方案都不适合我。
解决方案
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
)
推荐阅读
- c# - 我的代码文件中缺少库,而我的项目引用了正确的 dll
- intro.js - Select an element added at runtime when intro is running
- c++ - Arduino 编译器找不到头文件
- xpath - 使用 Xpath 在 Automation Anywhere 中的特定行之后获取表的所有行
- javascript - 如何使用 fs.writeFile 从 fetch API 调用响应创建 .json 文件
- php - Mac 上的 Django + XAMPP (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")
- android - 如何在没有 Web 服务的情况下从不同网络中的 android 连接到 sql 数据库?
- javascript - 调整窗口大小时打开响应式侧边菜单
- spring - 如何获取使用 springs 中的标准和规范运行的每个选择查询的结果大小?
- android - 如何在android中使用GSON检索jsonArray中的jsonObject