Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 30564  / 1 Year ago, sun, december 18, 2022, 6:18:04

I have dual booted to lubuntu (with Windows XP) and everytime and then I'm getting asked for my password. How do I run everything as root and not ask a password again? Ideally I wanted to run nginx but it has permission denied issues:



apathetic@ubuntu:~$ service nginx start
Starting nginx: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2012/08/03 20:06:25 [warn] 4762#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2012/08/03 20:06:25 [emerg] 4762#0: open() "/var/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed

More From » lubuntu

 Answers
4

It's a bad idea to run everything as root.



For things that actually need to be run as root (which includes service nginx start), the best way is to use sudo:



sudo service nginx start


By default, this will ask for your password if you haven't entered it in the last 15 minutes.



You can configure /etc/sudoers to let you run commands as root without entering your password using NOPASSWD. man sudoers for details.



(The visudo command is the recommended way to edit /etc/sudoers.)



If you insist on executing commands directly as root, you can launch a root shell with



sudo bash


or



 sudo -i


(equivalent to sudo --login).



My advice: Don't do this. Typing sudo for every command that actually needs root access helps remind you not to use it unnecessarily. It's very easy to shoot yourself in the foot.


[#36384] Tuesday, December 20, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ipentainer

Total Points: 112
Total Questions: 113
Total Answers: 113

Location: Guernsey
Member since Tue, Jul 6, 2021
3 Years ago
;