how to change user and run command as another user in Debian and Ubuntu


Using "su" Command!!!! I didn't use it for a long long time

This time I have a problem for running command in some user After using su many times. I saw my boss using "-" before username!!!!! Stupid Me!!! Ok, Enough for the history. Now this is the command:

$ su -, -l, --login "username"

If you want to execute commands

$ su -, -l, --login "username" -c, --command "commands" // I recommend you to use double quotes (") for sometimes we want to use arguments

for Examples

$ su - Nata-Oh , $ su -l Nata-Oh OR $ su --login Nata-Oh

$ su - Nata-Oh -c "ls -la" OR $ su - Nata-Oh --command ls

คำสำคัญ (Tags): #command#su#ubuntu#user
หมายเลขบันทึก: 212873เขียนเมื่อ 30 กันยายน 2008 11:30 น. ()แก้ไขเมื่อ 22 พฤษภาคม 2012 08:53 น. ()สัญญาอนุญาต: จำนวนที่อ่านจำนวนที่อ่าน:


ความเห็น (1)

Actually we can do with sudo for Example:

sudo -l Nata-Oh ls

พบปัญหาการใช้งานกรุณาแจ้ง LINE ID @gotoknow
ClassStart
ระบบจัดการการเรียนการสอนผ่านอินเทอร์เน็ต
ทั้งเว็บทั้งแอปใช้งานฟรี
ClassStart Books
โครงการหนังสือจากคลาสสตาร์ท