SSH: execute sudo command

I have an interactive shell script, that at one place needs to ssh to another machine (Ubuntu based) and execute something as root (the user should enter his password, but the remote command should run like noted in the script): # … ssh remote-machine ‘sudo ls’ # … However, I always get this error message … Read more

Sudo vs root; any actual differences?

I’m working with a support member for a product, and he insists that I need to be root to install a series of patches, and that sudo won’t work; he doesn’t provide a reason but seems very firm in his beliefs. Browsing Superuser I can’t determine any possible reason for this being the case, and … Read more

How do I make sudo preserve my environment variables?

Using sudo 1.7.4p4 on Solaris 5.10 and sudo 1.6.7p5 on RHEL4 u6 I can’t see how to preserve my environment variables, for instance $PYTHONPATH. I’ve added this line to sudoers, but it doesn’t make any difference: Defaults !env_reset Am I doing something wrong, or is the sudo installation simply not respecting the env_reset flag? Edit: … Read more

Where did the term “superuser” originate?

Where did the term “superuser” originate? Is it a shortening of “supervisory user”, or is it just an indicator of the level of power one such user holds in a system? Answer Where did the term “superuser” originate? su allows one to become the super–user, who has all sorts of marvelous powers. From the First … Read more

How to set path for sudo commands

If I issue sudo my-command how does Linux look for that my-command? The my-command is in my PATH. I can invoke it without any problem. However, when I invoke it with sudo, I’ll get command not found. How to overcome it? EDIT: That “Possible duplicate”‘s selected answer is wrong, well, at least not to the … Read more

command not found when using sudo

There are a few question on the site that seem related to my problem but I could not find a solution in any of them. My operating system is Ubuntu 12.04. I have mvn installed in /tools/noarch/apache-maven-3.1.1 and I have added the following lines at the end of my /etc/profile: export M2_HOME=/tools/noarch/apache-maven-3.1.1 export PATH=$M2_HOME/bin:$PATH After … Read more

Why does the system have /etc/sudoers.d? How should I edit it?

Last time, I asked about the risk of these (in /etc/sudoers): user_name ALL=(ALL) /usr/bin/vim /etc/httpd/confs/httpd.conf %group_name ALL=(ALL) /usr/bin/vim /etc/httpd/confs/httpd.conf While I was thinking about this problem, I found /etc/sudoers.d directory. Files in the directory should have similar functions to /etc/sudoers (meaning the scripts above are still problematic even in /etc/sudoers.d), and however one article said … Read more