sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

2
votes
1answer
32 views

User without a password - how can one login into that account from a non-root account

I have just started to use Scientific Linux (7.0) (although I assume this question might be distribution neutral..). The kernel version is 3.10.0-123.20.1.el7.x86_64. Coming back to my question. I ...
2
votes
1answer
57 views

sudo -i returns an error

When I try to switch to root using sudo -i i get the error /var/tmp/sclDvf3Vx: line 8: -i: command not found... However, su - works which I will continue to use. I'm by no means a linux system ...
3
votes
2answers
34 views

How could we allow non-root users to control a system.d service?

With sysvinit, a sudoers entry like this would suffice: %webteam cms051=/sbin/service httpd * This would allow for commands such as: sudo service httpd status sudo service httpd restart Now, ...
1
vote
1answer
28 views

Can I restrict sudoer nopasswd to directory?

Maybe I should rephrase - what is the most secure way to accomplish my needs? Details I am using WinSCP to modify my Apache document_root. The directory /var/www/html has an owner and group of root. ...
0
votes
1answer
25 views

sudo chown -R www-data & userexample /home/example/uploads

when typing in PuTTY sudo chown -R www-data /home/example/uploads My website is displayed but I cannot access my FTP but when typing sudo chown -R example /home/example/uploads I can access my FTP but ...
-1
votes
1answer
30 views

Mutiple commands after sudo in one line

I want to execute multiple commands after a sudo command su - appuser -c "cd /apps/bundle/bundle-client/bin ; export BDL_WEB_USER=not_used ; export BDL_WEB_PASSWORD=not_used ; ./bundle -b ...
1
vote
2answers
20 views

Script using sudo works from a terminal but not from a desktop shortcut

I create small script to mount encfs filesystem. just like this: #!/bin/bash kdialog --password "Wprowadź hasło do SSH lub ENTER żeby rozłączyć:" > /home/maciek/Pobrane/pass-1 sudo encfs -S ...
2
votes
1answer
18 views

sudo with original profile

I need to launch an app with root privileges, but the app requires access to the original user's profile....so just using sudo to start the app results in the app starting incorrectly. How can I ...
0
votes
2answers
48 views

grep with variable

I am trying to create a script to monitor all logins using sudo, both success and failure. Right now, I have: set tdate = $(date "+%b %d") set attempted_su_log = /var/log/suattempts cat ...
1
vote
0answers
17 views

How to specify regular expression for command arguments in sudoers

sudoers(5) manpage says that shell-style wildcards (aka meta or glob characters) could be used in command line arguments in the sudoers file. They are *, ?, [...] and [!...]. My idea is to use some ...
4
votes
5answers
100 views

sudo in non-interactive script

I have a script that executes three functions: A && B && C. Function B needs to be run as a super-user, while A and C doesn't. I have several solutions but neither of these is ...
0
votes
2answers
37 views

Bash function for piping data into protected file [duplicate]

I wanted to create a .bashrc function that would simplify passing data to a write-protected file. function pipe { sudo bash -c "$1" } Unfortunately the command pipe echo something > ...
1
vote
1answer
20 views

SUDO_USER undefined in sudo manual - clarification would be lovely

The following statement appears early in the sudoers manual, it refers to the "SUDO_USER environment variable" but the manual does not define it: If sudo is run by root and the SUDO_USER ...
2
votes
1answer
28 views

Secure way to allow any user to run programs in specific network namespace

I have a cell modem connected to my server that I want to use as a means to get notification emails out when the landline dies. To nicely separate normal network access and this exceptional cell ...
3
votes
4answers
93 views

SUID accidently removed from /bin/su file

It is a production server - CENTOS 6.1 Some user having root access in the past had logged on to the server and removed the SUID bit from the /bin/su file and then exited root. Now we are not able to ...
1
vote
2answers
49 views

How do I use my own local text editor to modify system (requires root to save) files on a remote system?

I've recently fallen in love with github's Atom text editor, and I enjoy using it for all my local coding and configuration. I started to maintain a Nagios installation for several dozen servers and ...
2
votes
1answer
22 views

Sandbox an account and prevent it from any system modifications

I am trying to sandbox a user account to the point where it cannot edit or view any files beyond a certain folder, namely /home/user/test. This account will be compiling and running a C++ program that ...
0
votes
1answer
42 views

Restore sudo privileges

Trying to install tor-browser, I screwed up my sudo privileges when I tried to take ownership of a directory. Now I get a message: sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit ...
1
vote
1answer
39 views

su or sudo keeping/removing certain environment variables

I would like to be able to log in as another user and keep most, but not all of my environment. Specifically, I would like to set $HOME to the correct value for the new user, but keep probably ...
1
vote
2answers
54 views

Why does sudo ask for a password?

USER@notebook:~/foo/notebook$ sudo /usr/bin/mplayer /home/USER/foo/notebook/something.mp3 [sudo] password for USER: USER@notebook:~/foo/notebook$ USER ALL=(ALL) NOPASSWD: /usr/bin/mplayer ...
1
vote
3answers
76 views

How can I make sudo forget the password automatically after one command?

My problem is the following: I want to edit a file that is only readable by root. That's why I use sudo vim ~/thefile I could type sudo -K after exiting vim, but I was hoping that there's an ...
0
votes
2answers
25 views

Is there a sudoedit equivalent for vimdiff?

I'm trying to get into the habit of editing root-owned files with sudoedit, instead of sudo vim. This has a few advantages, one of which is that it uses my user's ~/.vimrc. Is there an equivalent, ...
1
vote
1answer
29 views

Different password for login and sudo - security concerns

I'm planning to follow the steps described in this answer to have a different password to log in and sudo. The reason is that I want a high security password to access my account or unblock the ...
0
votes
1answer
23 views

Is it possible to capture SSH+sudo output locally without writing the hostname and [sudo] lines?

Is it possible, when locally writing output from SSH command execution, to suppress the hostname and [sudo] lines? For instance, when I SSH into a server and run sudo <command> it displays ...
0
votes
1answer
66 views

C/C++: Running multiple commands as root

I want to execute commands within my C program. However, I need root priviliges to create some folders. I run the following: system("echo <rootpass> | sudo cd <folder> && make ...
2
votes
3answers
40 views

How to launch xev from console?

I am trying to launch Xev from console, it always gives "unable to open display", I need to launch xev from a console as another user (I use sudo -u '#1000' to do this). I know xev has a "display" ...
1
vote
1answer
46 views

How do I install some required libraries for a program without sudo?

I am trying to run a program on a computer running Red Hat 6.5. This results in the three following errors: "/lib64/libc.so.6: version `GLIBC_2.14' not found" "/usr/lib64/libstdc++.so.6: version ...
0
votes
2answers
28 views

Ubuntu CentOS RHEL cross bash script su support

I know that title was a little ambiguous. Allow me to explain our issue. We designed an installer script on Ubuntu since Debian based systems are our primary core, however, some of our cloud based ...
-1
votes
1answer
30 views

sudo issue during echo something to a root file [duplicate]

I have a problem, during write something into a root file: $ ll /sys/bus/usb/devices/3-2/power/wakeup -rw-r--r-- 1 root root 4096 Feb 16 17:28 /sys/bus/usb/devices/3-2/power/wakeup $ sudo echo ...
0
votes
0answers
11 views

Will I be able to install a service as a sudoer?

I will need to install a custom application as a service on a RHEL 6.2 box this weekend. Will I be able to do this with sudoer powers or will I need the root password for anything?
0
votes
0answers
53 views

apache user cannot sudo while running via httpd

I have a requirement where an web application (php) must run a script on another server. I tested running the remote script as apache user by sudo-ing to the apache user via the root user. The script ...
1
vote
1answer
45 views

File that is only readable with root privileges

I have a binary file that needs to run at startup on all accounts (including unprivileged user accounts), so a command to run it will be put into /etc/rc.local. The program itself will have only ...
3
votes
1answer
38 views

Puzzle over sudo and paths

I have a couple of programmes which are in /usr/local/bin which require root privileges to run. If I run sudo my_prog I get sudo: my_prog: command not found I have to write sudo ...
1
vote
1answer
35 views

Hotkey for doing sudo suggestions

On Ubuntu and Debian, often if I try to run a program I will get a message that says something to the effect of: You don't have that program. To get it type sudo -apt -get -install programName ...
0
votes
1answer
40 views

finding and replacing text [duplicate]

Does any one know how to find and replace text in a file. it can be implimented into a bash file. i would like to find the line and the output the text to it the file can only be opened with the root ...
0
votes
1answer
151 views

ERROR: no tty present and no askpass program specified ; TTY=unknown ; PWD=/ ; USER=root ; [duplicate]

In my /etc/sudoers.d/myAppCommand file I set some command like this. Cmnd_Alias APP_CMD = /opt/myApp/lib/app-start, \ /opt/myApp/lib/app-stop, \ ...
24
votes
6answers
3k views

Why is it risky to give sudo vim access to ordinary users?

I'd like to create a new user and give him sudo access. To be specific, I want him to use sudo vim and edit httpd.conf. I wrote this in sudoers: user ALL=(ALL) /usr/bin/vim ...
3
votes
1answer
183 views

Can I run a command loaded from .bashrc with sudo?

I have some custom functions and aliases defined in my .bashrc file. Sometimes I need to execute whem as root. I then do something like: $ sudo custom_cmd 80 ...
0
votes
1answer
33 views

How to add “sudo” group

I've done a mistake: I've removed the 'sudo' group, because I have forgotten the -a option (I wanted to add 'video' group): sudo usermod -G video $USER Now, when I want to call sudo I have this ...
0
votes
1answer
53 views

“Sudo” prefixed command doesn't work; without sudo does.

I suspect this has been answered before, but I don't know what this is called, so I can't really search for it. How come this works : $ grep H=p <(udevadm info /dev/ttyUSB0) E: ...
2
votes
2answers
120 views

What is the meaning of sudo sudo?

I am using Cloud9 for Rails development and it uses an Ubuntu environment. In the documentation about using the PostgreSQL database, it says: Connect to the service: $ sudo sudo -u postgres psql ...
-2
votes
3answers
4k views

Username is not in the sudoers file. This incident will be reported

I am running Ubuntu 12.04 on my laptop using VMware Player. I am not sure why but I have an account called "User Account" in addition to my account that I usually login to use Ubuntu. Well that was ...
1
vote
2answers
39 views

sudo command is unsucessful when invoked from file manager

I'm trying to run the following script on an install of Fedora 20. #!/bin/bash password={password} echo "$password" | sudo -Sk /bin/bash -c '[[ $EUID -eq 0 ]]' [[ $? -ne 0 ]] && zenity ...
4
votes
2answers
856 views

Is 'echo “Defaults insults” >> /etc/sudoers' safe?

Is this safe? echo "Defaults insults" >> /etc/sudoers If yes, can I do this? echo "## First line" >> /etc/sudoers echo "### Second line" >> /etc/sudoers echo "Defaults ...
9
votes
3answers
523 views

Why does the root user need sudo permission?

[root@notebook ~]# grep root /etc/sudoers root ALL=(ALL) ALL Question: Why does the root user need sudo permissions? I've seen it on different UNIX OSes. Can someone please explain this?
1
vote
2answers
63 views

Locked out of my own mac terminal?

So recently, some of my friends had been tampering with my files and data through terminal, so I decided to secure it by doing two things: First, I added the following to my ~/.bash_profile for ALL ...
0
votes
1answer
33 views

Sudoers - group managing and reboot/shutdown

I've got a group (let's say name "group1", ID = 1234) and a user (let's say name "user1", ID="4321"). I want to do two things: I want that user to change passwords from other members of that group, ...
0
votes
1answer
35 views

How does sudo -E work here?

I executed the following command to add a ppa repository in Ubuntu: sudo add-apt-repository ppa:ppaname/ppa This command returned an error that the ppa name format is not correct. Then I looked here ...
2
votes
1answer
60 views

Use current user environment variable in sudoers file

I want some of my users to be able to change their password with sudo command because at the time they log in, they are passwordless (ssh keys connection). My users have no password (and this is ...
1
vote
1answer
47 views

Difference between sudo make and sudo -s ; make

What are the differences between sudo make and sudo -s make First example do not work with my software, there is always a header file missing. Login as root with sudo -s and compile works fine. ...