Tuesday, August 4, 2009

Execute sudo command without asking for password

คอนฟิกให้ใช้ sudo โดยปราศจากการถามพาสเวิร์ด

If you are tired of typing password every time you execute a sudo command,and you are the only user for the operating system, you may want to skip typing password when running a sudo command,this tutorial will explain how to do that easily.

First,open a terminal window and type following to go to root(it is necessarily,or you cannot use sudo command if you execute sudo chmod 740 /etc/sudoers,only by restart to go to recovery mode to change it back to 0440 ):

sudo -i

You’ll be root after inputting password,and execute command:

chmod 740 /etc/sudoers
gedit /etc/sudoers

At the file window,change the last line to %admin ALL=(ALL) NOPASSWD: NOPASSWD: ALL

Save and close the file,then type following command:

chmod 0440 /etc/sudoers

Done.


Tips:

If you want to back as before,type following command:

sudo -i

Following code is to deal with the ready only file:

chmod 740 /etc/sudoers

Edit the file by:

gedit /etc/sudoers

Change the last line back to

%admin ALL=(ALL) ALL

Save and close it .


Note:

  • ที่ไม่คัดลอกภาพเค้ามา แต่ใช้ภาพตัวเองเพราะ กลัวสักวันปลายทางภาพจะเดี้ยงอ่ะนะ

No comments:

Post a Comment

Popular Posts