sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

-1
votes
0answers
18 views

Unix server -bash: sudo: command not found

I Just bought a server where i have to Install apache2 server when I try using command line sudo apt-get install apache2 than it's gave me error like -bash: sudo: command not found Also apt-get ...
1
vote
1answer
14 views

ssh with -Y results in “shell-init: error retrieving current directory: getcwd: cannot access parent directories…”

I ran an X app sudo'ed from my normal account, using: mylappy$ ssh -Y me@myhost.com me@myhost.com's password: [me@myhost ~]$ sudo su - [root@myhost ~]# su - me -c 'xauth list' |\ grep `echo ...
3
votes
1answer
30 views

How do I allow non-root users to control a systemd service with instances?

I need to allow users in the dba group to control the database@ services. The answer to this related question is to just list all systemctl "verbs" that I want to allow in the sudoers file, however, ...
2
votes
1answer
23 views

Run a command a as a certain user and multiple groups with sudo

I am trying to allow an normal user to run some applications under other UIDs for process separations. The applications should run with certain groups permissions (like audio or cdrom). In the ...
1
vote
1answer
14 views

Parallels on Mac - can no longer sudo within Ubuntu

I have been using Parallels on my Mac to run Ubuntu for a couple of weeks and it's been fine. Today I tried to install a package and received the following error: {user} is not in the sudoers ...
0
votes
2answers
59 views

executing command as su

I am executing this command as su. I have made the connection with SSH (using sshNet), and then when I try to set the command su -, I get no response. I have the password and the command I would like ...
5
votes
1answer
85 views

Edited sudoers file with text editor - now can't run sudo

I now know that I should never try to edit the etc/sudoers file with a regular text editor. However, minutes before I learned this, I saved a new user name in the file with Sublime Text. Now when I ...
1
vote
1answer
54 views

Running some parts of a script as an unprivileged user with shell environment

I am creating an instance configuration script that sets up a machine. I am running the script via sudo i.e. sudo run.sh. Most of the steps require root access but some of the script's steps do no ...
4
votes
1answer
260 views

Why isn't this directory being added to my PATH when I use sudo?

Ive just compiled and installed apache webserver from sources, and now I want to add the apachectl script to PATH I know I need to add the directory to the root user's PATH (as the script needs to be ...
1
vote
0answers
50 views

Execute sudo command in C with system() [migrated]

I am writing a piece of C code that will run some sudo command in system("sudo ip route ...") function call. This call is being done in a pthread created by the main thread, and the main program is ...
0
votes
1answer
63 views

Some index files failed to download - Linux Mint 17.1 Cinnamon

Running sudo apt-get update i get the following error message: ... Ign http://packages.linuxmint.com rebecca/upstream Translation-en_US Ign http://packages.linuxmint.com rebecca/upstream ...
2
votes
1answer
22 views

NOEXEC and RESTRICT in sudoers

I understand the script below has a serious problem, and NOEXEC and RESTRICT are not enough as a solution to this. user ALL=(ALL) /usr/bin/vim /etc/httpd/confs/httpd.conf However, I still have some ...
0
votes
1answer
31 views

Prompting for a password on sudo?

I'm creating users using Puppet. Here's the gist of what I'm doing in Puppet: user { 'ntkay': name => 'ntkay', uid => 10000, home => '/home/ntkay', managehome => true, ...
2
votes
1answer
44 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
66 views

sudo -i returns an error [closed]

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
61 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
33 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
28 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
33 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
20 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
56 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
28 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
144 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
40 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
26 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
35 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
95 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
64 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
23 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
52 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
52 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
55 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
77 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
30 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
33 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
29 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
96 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
56 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
57 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
37 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
34 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
12 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
63 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
46 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
210 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 ...