sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

2
votes
2answers
315 views

Why sudo timestamp is not updated when NOPASSWD is set?

I've set up sudo not to prompt for password by editing the sudoers file: myuser ALL=(ALL:ALL) NOPASSWD: ALL And it works fine, running sudo with no password prompting. But when entering sudo -v I ...
3
votes
3answers
737 views

How can I use `sudo` with a command, but still “be myself”?

My SysAdmin is requiring me to use sudo to run a certain script. This script (depending on which subcommand you pass in as an argument) connects to another machine using ssh keys, but this is ...
1
vote
2answers
2k views

X11: Client not authorized when calling with sudo [duplicate]

Possible Duplicate: Can I launch a graphical program on another user's desktop as root? I'm trying to do the equivalent of: $ sudo -u myuser DISPLAY=:1 xterm However, it give me the ...
4
votes
1answer
4k views

Tracking what commands were executed after sudo to another user

I have provided sudo to ten users to become another user like nsup. I want to track which user executes which command after they become nsup. If there is a way to store the log files in a common file ...
5
votes
1answer
5k views

Why does cron silently fail to run sudo stuff in my script?

I have a script run from a non-privaleged users' crontab that invokes some commands using sudo. Except it doesn't. The script runs fine but the sudo'ed commands silently fail. The script runs ...
4
votes
1answer
162 views

Emptying a directory owned by another user weekly

I have a temp directory set up where users can place whatever files they need to send to other users via HTTP. The owner of this directory is an SFTP user, and cannot run cron jobs. I have one shell ...
14
votes
4answers
871 views

How universal is sudo?

I was writing some instructions on how to install something (TeX-related - if you don't ask, I won't ruin your day by supplying more details) and used sudo to install system-wide. Someone commented ...
2
votes
0answers
474 views

Sudo yum permission denied Fedora 17

On Fedora 13, in /etc/sudoers I used to have a line: Cmnd_Alias SOFTWARE=/usr/bin/yum and then for a user that would have the privilege of installing his/her own RPM packages, an entry like: ...
4
votes
2answers
577 views

Running programs as root with my own password in Scientific Linux

In Debian-derived Linux distros, if you are not root but are authorized in /etc/sudoers, GNOME will ask you for your own password to allow privileged operations. However, Scientific Linux asks you ...
0
votes
3answers
463 views

How do I execute a newly installed application with Sudo?

I have just installed an application on my Amazon EC2 instance called sshpass. I am having trouble getting it to work properly ( although, it works correctly on a non AWS instance ). I've read in ...
1
vote
3answers
1k views

Root permission - username ALL=(ALL) ALL does not work

I'm a beginner. I'm trying to give my user root permissions, so I edited the sudoers file like this: black ALL=(ALL) ALL "black" is my username. But I still don't have root permissions, and ...
3
votes
3answers
292 views

Prevent users from killing processes that they own

I have started some processes (window based) from user's .bashrc file. I want to prevent users from killing those processes. Is there a way to transfer the process to superuser so that a normal user ...
3
votes
2answers
7k views

Execute shell script from php, as root user?

Need to execute the following line from PHP: $res = shell_exec('sudo sh /home/nicklas/cronjobs/make_account.sh username password'); The problem is nothing happens on execution. If i try to ...
4
votes
1answer
626 views

Automate login with sudo and su

I know the security risks, but I am performing this experiment/excercise on an old, seldom used *nix machine I have laying around the house. So doing this excerise will not bring any security risk to ...
0
votes
3answers
79 views

how to access homedir by root user

I want to access root user's home directory /root/. However following commands dont lead me to the root directory. sudo -s cd ~ It leads to the home dir of regular user. How to access /root ...
2
votes
4answers
1k views

Allow paswordless user to change to another passwordless user

I have two users dev and tomcat neither of them have a password. How can I allow dev 1 do su - tomcat without having him having to enter any credentials? 1 connects with ssh keyfile
4
votes
2answers
533 views

Why is `sudo pkill -HUP -f “nginx: master process”` returning code 129 and no output

I'm trying to trigger a reload of the Nginx master process by using pkill and sudo. The server reloads fine, but I was just curious if anyone knows why the command sudo pkill -HUP -f "nginx: master ...
3
votes
1answer
506 views

Keep kerberos ticket across sudo invocation

On a regular linux machine, when I use sudo -s as a normal user, I become root but HOME still points to ~user, so every admin has his own environment etc. (this is without env_reset or always_set_home ...
6
votes
3answers
9k views

How to restrict to run commands in specific directory through SUDOERS?

I can run chown and chmod commands by sudo system-wide, but want to run these commands in only /var/www/html directory. How can restrict commands to run only in specified directory by sudo ...
0
votes
4answers
134 views

Trying to setup sudo user

I'm trying to setup sudo with no password but still I get prompted for password. I'm using Ubuntu, here is the relevant line from the sudoers configuration file : gandalf ALL=(ALL:ALL) NOPASSWD: ...
3
votes
2answers
1k views

How to solve sudo: unable to execute /bin/ls: Argument list too long

When I run this command from php sudo -u db2inst1 ls -t /var/lib/edumate/bdrs/*/*/daily/*NODE* | sort -r I receive sudo: unable to execute /bin/ls: Argument list too long ls lists all daily backup ...
4
votes
1answer
2k views

Allowing a user to use sudo without a password

On a sandbox VM environment, I have a setup of Ubuntu Linux which is firewalled and cannot be accessed from outside the local system. Therefore, on that VM, I'd like to give the administrative user ...
4
votes
1answer
552 views

How to run this in sudo?

I have this line that I execute from php sudo -u db2inst1 -s -- "/opt/ibm/db2/current/bin/db2 connect to PLC; /opt/ibm/db2/current/bin/db2 \"update EDU.contact set MOBILE_PHONE = '123'\"" it works ...
2
votes
2answers
2k views

SFTP and sudo using Windows client?

I want to download files from a linux system using a windows client. While there are many SFTP clients I am having the problem, that I need to access files where I need to be root. On the linux system ...
1
vote
2answers
3k views

SSH + Sudo + Expect in Bash script: Run command with sudo in remote machine

I am trying to automate the deploy of some .deb packages with an script. I want to execute sudo dpkg -i $myDeb.deb in a list of remote machines I can access with ssh. I've tried to automate the ...
2
votes
2answers
296 views

Kubuntu - GUI context menu sudo/root

A couple of years ago I found something in a package manager that added a context menu item that allowed me to open files and save them normally without being harassed about file permissions. Can ...
5
votes
2answers
1k views

Stay at same working directory when changing to sudo

When working on the command line, I often change to sudo using sudo -i. However, my working directory changes automatically to /root. I never want to go there; I want to stay where I was! How can I ...
1
vote
1answer
338 views

Is there a shorter way to change username, home directory and move files at the same time

I wanted to use and have tried sudo usermod durrantm_test -mdl durrantm_test2 but I get Usage: usermod [options] LOGIN ... However sudo usermod durrantm_test -l durrantm_test2 -md ...
3
votes
2answers
3k views

executing if-statement from command prompt

In bash I can do the following: if [ -f /tmp/test.txt ]; then echo "true"; fi However, if I add sudo in front, it doesn't work anymore: sudo if [ -f /tmp/test.txt ]; then echo "true"; fi -bash: ...
0
votes
0answers
342 views

Segmentation fault while doing `sudo su -`

I am getting a segmentation fault error while doing sudo su - or sudo su - username in Linux Server (RHEL 4.7). Can any one help me resolve this issue? Linux server (RHEL 4.7) is a LDAP client.
3
votes
4answers
3k views

Allow non-admin users to install packages via apt or rpm?

Is it possible to allow non-root users to install packages system-wide using apt or rpm? The place where I work currently has an out of date setup on the linux boxes, and admins are sick of having to ...
11
votes
3answers
4k views

sudo cannot open /etc/sudoers

sudo does not work. I have installed Arch Linux onto a USB key formatted with BTRFS. The output of sudo is: $ sudo sudo: unable to stat /etc/sudoers: Permission denied sudo: no valid sudoers sources ...
18
votes
3answers
953 views

Where can I find documentation about the “sudo !!” command

I just learned that Linux has a sudo !! command which literally applies sudo to the last entered command. I had never heard about it. Is that a common control? Where can I find documentation about ...
4
votes
4answers
2k views

Is chmod behavior wrong for symlinks?

Recently we had a problem on a Red Hat Linux box with many users: the /usr/bin/sudo binary has lost its sticky bit. Work was blocked until root user fix it (we need sudo for deploying and testing). ...
1
vote
2answers
988 views

I accidentally deleted the sudoers file on Mac OS X; is there any way to recover it?

I accidentalley deleted the sudoers file on Mac OS X; is there any way to recover it? And once you've recovered it, how do you set it to mode 0440? I presume not but I am desperate to get it back!
8
votes
5answers
9k views

Can a linux user change their password without knowing the current password?

I'm setting up a few ubuntu boxes, and using opscode's chef as a configuration tool. It would be fairly easy to install public keys for each user on each of these servers, and disable password ...
1
vote
0answers
507 views

Gnome update-notifier doesn't show updates when user not in sudo group (Debian Squeeze)

Gnome desktop notifications of new updates is not working on my system. I noticed that the notifications stopped working when I removed my desktop user from the sudo group (I prefer to have a separate ...
17
votes
2answers
2k views

How does sudo remember you already entered root's password?

When using sudo on Linux, it asks for root password, but only the first time you run it. If you run another sudo command, it remember you already entered the password previously and doesn't ask for ...
1
vote
1answer
921 views

exclude commands from user's sudo permissions

Consider the following line in a /etc/sudoers file: username ALL=(ALL) ALL, !/usr/bin/passwd as far as I know, this allows user username to use sudo, unless he not uses /usr/bin/passwd. But ...
1
vote
2answers
947 views

How to configure sudoers to allow running sudo command under other group and user name?

How to configure sudoers to prevent having the Sorry, user ****** is not allowed to execute error message. Background For the purpose of testing how a python script under a less privileged user and ...
15
votes
2answers
6k views

su vs sudo -s vs sudo bash

What is the difference between the following commands: su sudo -s sudo bash I know for su I need to know the root password, and for sudo I have to be in the sudoers file, but once executed what is ...
2
votes
0answers
357 views

How to enable `sudo` with custom functions?

Recently I learned you can enable sudo for custom aliases as follows: alias sudo='sudo ' # note: the space is required! The reason this works is the following: If the last character of the ...
1
vote
2answers
638 views

permission reporting on sudoers

I'm looking for a good, consistent and easy way to do a report of sudoers permissions for every user and group on the system. For users, I want the report to include permissions granted via group ...
0
votes
4answers
5k views

Is there a difference between sudo su - root and sudo -u root -H /bin/bash?

Like title says, is there a difference between these two commands : sudo su - root sudo -u root -H /bin/bash I'm using GNU/Linux, if that makes a difference.
5
votes
2answers
4k views

tail program output to file in Linux

I know we can use below format to redirect the screen output to a file: $ your_program > /tmp/output.txt However when I used below command, it says "-bash: /home/user/errors.txt: Permission ...
11
votes
2answers
2k views

zsh wants to correct vim to .vim

I'm using zsh on Gentoo x64, and when I type sudo vim /path/to/file from my home folder, zsh asks: zsh: correct 'vim' to '.vim' [nyae]? I want to run vim not my .vim folder. How do I fix this? ...
3
votes
2answers
1k views

Problem with vim when logged in as root

When I login as root or edit a file by sudo mode all of the options in my /etc/vimrc are not working (e.g. highlight line-number etc.)
1
vote
1answer
5k views

switching from user to root and revers (freebsd)

i want to make some modificaciones with root and then with my user, in fact i want to install sudo and he give me the error in the first step: cd /usr/ports/security/sudo make install clean ...
1
vote
2answers
406 views

start apache script

I've got Apache installed on my local Linux (sabayon) OS, just for programming testing. What I want is a script so that the server starts right away when I want it. This is the code: #!/bin/bash # ...
2
votes
3answers
5k views

Run sudo as another non-root user and save in this user's home directory

I added a new group: ircuser and a new user: ircuser In visudo I placed this line: myuser localhost=(ircuser) NOPASSWD: /usr/bin/irssi Created ircuser directory, where config files, caches, etc ...