Questions tagged [sudo]

The sudo command is a program for Unix and Unix-like computer operating systems that allows a user to run programs with the security privileges of another user (normally the superuser, or root). The name is an abbreviation for "substitute user do" (as in, do a command as if started by another user).

The sudo command is a program for Unix and Unix-like computer operating systems that allows a user to run programs with the security privileges of another user (normally the superuser, or root). The name is an abbreviation for "substitute user do" (as in, do a command as if started by another user).

Unlike the su command, users typically supply their own password to sudo rather than the root password. After authentication, and if the /etc/sudoers configuration file permits the user access, then the system will invoke the requested command.

2818 questions
25
votes
5 answers

npm command - sudo or not?

Currently I always run sudo npm install but as I understand it's not correct. I want to have opportunity not to use it as root/Administrator. I followed some advice and used this command sudo chown -R ~/.npm but it won't…
Kosmetika
  • 20,774
  • 37
  • 108
  • 172
24
votes
3 answers

How does `alias sudo="sudo "` work?

Looking at ways to pass current user's aliases to a sudo command, I found the following on ArchWiki: Passing aliases If you use a lot of aliases, you might have noticed that they do not carry over to the root account when using sudo. However,…
PLNech
  • 3,087
  • 1
  • 23
  • 52
23
votes
2 answers

Docker: why do I need to sudo in Linux?

I am working through this tutorial setting up Docker, and I'm finding that all of their examples are written like docker run hello-world but when I try it, it says permission denied on a socket and I have to do sudo docker run hello-world to run…
adamconkey
  • 4,104
  • 5
  • 32
  • 61
23
votes
5 answers

How do I run a command as a different user from a root cronjob?

I seem to be stuck between an NFS limitation and a Cron limitation. So I've got root cron (on RHEL5) running a shell script that, among other things, needs to rsync some files over an NFS mount. And the files on the NFS mount are owned by the apache…
rob
  • 337
  • 1
  • 4
  • 9
23
votes
3 answers

Using sudo with for loop

I want to run a simple for loop command with sudo, but it isn't working: sudo -i -u user for i in /dir; do echo $i; done I get the following error: -bash: syntax error near unexpected token `do' Probably a very simple thing I am overlooking. Any…
Axl
  • 427
  • 2
  • 7
  • 19
22
votes
6 answers

sudo nohup nice <-- in what order?

So I have a script that I want to run as root, without hangup and nicely. What order should I put the commands in? sudo nohup nice foo.bash & or nohup nice sudo foo.bash & etc. I suspect it doesn't matter but would like some insight from those who…
Jonah Braun
  • 4,155
  • 7
  • 29
  • 31
21
votes
3 answers

CentOS error - sudo: effective uid is not 0, is sudo installed setuid root?

I found another question with the same headline, however, I suppose my case is a bit different. In an attempt to setup the new project, I needed to install nodejs. I realised that it worked only when used with sudo. For eg. sudo npm Furthermore, I…
Swanidhi
  • 2,029
  • 1
  • 20
  • 21
21
votes
1 answer

What's the difference between `sudo -i -u user` and `sudo su - user`?

Both commands: sudo -i -u username sudo su - username Will log me in as username if I enter my password. Is there actually any difference between these commands?
Jan Dudulski
  • 843
  • 1
  • 8
  • 14
21
votes
6 answers

Ruby on Rails Beta 3 Install on Snow Leopard - file not found

I tried to install the new beta on my system with the command: sudo gem install rails --pre but no matter what I tried, I still get this damn error: Successfully installed rails-3.0.0.beta3 1 gem installed Installing ri documentation for …
Yolcu
  • 211
  • 1
  • 2
  • 3
21
votes
3 answers

Capistrano mkdir permission denied

When I run cap production deploy I get cannot create directory ‘/var/www/application/repo’: Permission denied. So far I've created deploy user like: adduser deploy adduser deploy sudo and I use this user in Capistrano. Indeed, when I log to…
Kamil Lelonek
  • 14,592
  • 14
  • 66
  • 90
21
votes
2 answers

Running external commands through os/exec under another user

Using the os/exec package, I want to run an external command on a *nix OS, on behalf of another user (of course go process run under root user of another user with su privileges) I want avoid "su" or "bash" commands and make it purely with go. I…
mcuadros
  • 4,098
  • 3
  • 37
  • 44
21
votes
7 answers

X11: run a gnome app as another user

I have ubuntu + x11 + gnome. I want to run a graphical application as another user. However, when I start it from the command line using sudo -u otheruser app I get the error "No protocol specified". How can I work arround this?
flybywire
  • 261,858
  • 191
  • 397
  • 503
20
votes
1 answer

Suppress log entry for single sudo commands

For server monitoring, we execute couple of commands with password-less sudo every minute. This fills the server logs. sudo: zabbix : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/foo/bar Can I prevent these entries? The options NOLOG_INPUT and…
StephenKing
  • 36,187
  • 11
  • 83
  • 112
20
votes
1 answer

Accessing the GPIO (of a raspberry pi) without ``sudo``

This question might not be specific to the raspberry pi, of course. Also, I'm relatively new to Linux. I want to write a little library (in node.js, if that matters) to access the GPIO of the raspberry pi using the sysfs. However, accessing the…
Rakesh Pai
  • 26,069
  • 3
  • 25
  • 31
19
votes
8 answers

How to run sudo with Paramiko? (Python)

What I've tried: invoke_shell() then channel.send su and then sending the password resulted in not being root invoke_shell() and then channel.exec_command resulted in a "Channel Closed" error _transport.open_session() then channel.exec_command…
Takkun
  • 8,119
  • 13
  • 38
  • 41