Questions tagged [sudo]

The sudo command is a program for some Unix and Unix-Like operating systems, that allows a user to execute programs with the security privileges of another user. Typically those of a superuser or the root user.

Filter by
Sorted by
Tagged with
2 votes
0 answers
1k views

How to chain a command after sudo su?

The idea is simple, for example: alias foo='sudo su foo && cd /tmp' However, it does not execute commands after switching users. In this case, it switches users but does not cd into /tmp.
9 votes
4 answers
40k views

I/O error on Linux: cannot remove directory as root

ubuntu@ubuntu:/usr/lib/locale$ sudo rm -R nl_NL.utf8 rm: cannot remove directory `nl_NL.utf8': Input/output error I'm having problems deleting a seemingly corrupted directory to allow for a ...
0 votes
1 answer
1k views

How can I su to user and then sudo command without asking for password?

I want to run sudo as a user after changing to them from root without asking for their password or changing any settings. Step 1: change to user, from root server:~#su joseph Step 2: run sudo on ...
1 vote
1 answer
2k views

How to run a command with sudo from a certain path?

I'm setting up some automation with remote controlled bots. It's imperative that these bots have only exactly the permissions to run certain commands (I can't open the permissions too much in the ...
0 votes
1 answer
1k views

sudo bash -c gave permission denied

In my linux (centos 7), there are 2 users A (normal user) and B (belongs to wheel group). I am trying to change User A's .bash_profile file by running the following command with user B. ./test.sh /...
0 votes
1 answer
53 views

Why when I try to change user I obtain this error message? “myusername is not in the sudoers file”

I am not so into Linux and I have the following problem. I have to change user (using a given user) on a Linux server. So I use the [myusername@myserver~]$ sudo -i -u otherusername [sudo] password ...
2 votes
0 answers
1k views

How to update a program that was manually compiled from source?

What is the best way to install an update I have manually compiled from source to a program I also previously manually compiled from source? Should I execute sudo make uninstall first and then ...
1 vote
1 answer
128 views

File Modification Restrictions for Sudo/Linux as in UAC/Windows

In Windows UAC, if the user attempts to run an executable file, the OS will prompt the user whether or not they intend to run it. Similarly, if the application requires admin privs, the user is ...
1 vote
2 answers
1k views

Can I create a temporary sudo shell?

I love the feature of sudo where after authenticating once, for the next N minutes (15?) when I run sudo I don't have to input my password. I often do work inside a tmux window and I've developed a ...
1 vote
1 answer
3k views

Sudo doesn't work: "/etc/sudoers is owned by uid 1005, should be 0" - Ubuntu

When I tried to change the user to root using sudo su command. it shows the below error. Is there away to solve this issue? dasitha@dev-digin-io:~$ sudo su sudo: /etc/sudoers is owned by uid 1005, ...
0 votes
1 answer
331 views

Removing files created by another user with rsync

Problem I have the following scenario: motion is creating directories and files with the user:group motion:motion and the permissions 755 as a cron task, I'd like to periodically copy these files to ...
0 votes
0 answers
1k views

users are getting sudo to root though it is blocked

I have below entries in sudoers file but users are getting access to root, need to block the same. Cmnd_Alias SUROOT=/bin/su -,/bin/su - root, /bin/su root, /usr/bin/su -, /usr/bin/su - root, /...
1 vote
1 answer
66 views

Using tee, I lose my sudo privileges

I am writing an installer script and need to run it a sudo as I test it on AWS RedHat instances, so can't directly go as root. I want to write the log into a file as well as onto the screen. Nothing ...
0 votes
1 answer
2k views

C program cannot open serial port on OS X when user is member of 'wheel'

I have a C program that opens a serial port. The code is not the issue here. When I run the program as sudo it works fine and opens the port. When I run it as myself (normal user) it fails to open the ...
2 votes
0 answers
288 views

AIX sudo rootsh

I'm allowed to do: sudo /usr/bin/rootsh -i -u user Additionally I want do something like: echo 'date' | sudo /usr/bin/rootsh -i -u user Here I get the answer: no tty/pty on stdin: Not a ...
0 votes
1 answer
2k views

Cannot unpack a file with sudo cpio

I have sudo permissions and I'm trying to unpack a file with cpio command. However, because of the path properties I get permission denied when I try to do it. $ id uid=4777(testuser) gid=100(users) ...
4 votes
1 answer
640 views

Can I make sudo share cached credentials between terminals?

On my Ubuntu, sudo caches credentials. But if I open another terminal window and sudo in that one, the cached credentials are not shared and I have to re-enter my password. Can I have sudo instances ...
1 vote
2 answers
1k views

Add /sbin to $PATH but just temporary

There are many answers about how to add a directory to $PATH. However, I am looking for a way to add it to a path temporarily. For example, when running a script as sudo, not all scripts have the ...
0 votes
1 answer
115 views

add user accessible only to single other user

On my Ubuntu 16.04 workstation I have user provided by IT staff, named "john.smith". This account is in wheel group, has password managed by LDAP (I think... I know it changes in sync with other ...
5 votes
2 answers
4k views

Wireshark: Accessing USB Bus Interfaces without sudo

I am trying to monitor some USB traffic using Wireshark on Linux (Ubuntu). If I start Wireshark as my normal user without root privileges, the USB bus interfaces are not listed. If I sudo wireshark ...
1 vote
0 answers
2k views

Sudo command error in Mac OS X “no valid sudoers sources found, quitting”

How do I fix this response? MacPro:~mymac$ sudo -i sudo: unable to stat /etc/sudoers: Permission denied sudo: no valid sudoers sources found, quitting The sudoers file looks ok as far as I can tell....
0 votes
2 answers
3k views

www-data access to log files

I have a perl script that works fine with sudo and parses some logfiles at /var/log/ in Ubuntu 14. I want to show the program output on a webpage. My webpage code is very simple: <html><body&...
1 vote
2 answers
210 views

binding root pass into sudo command

is it possible to to have a sudo command executed with the admin password? example : sudo apt-get update -password is 'root' this is to put a command into an application on the startup of Ubuntu ...
1 vote
0 answers
335 views

Restart a daemon without root in OSX

On OSX 10.10 I created a plist file in /Library/LaunchDaemons/ to start at launch an OpenVPN connection. However I encountered DNS problems when going from an internet interface to another (as WiFi to ...
1 vote
1 answer
529 views

How to allow web server user to trigger script that needs sudo permissions?

Is it possible to make the web server user, lighttpd in my case, to trigger a specific script that needs to run with sudo permissions? I only want the lighttpd user to be able to trigger that one ...
3 votes
1 answer
615 views

Is there a way to tell which other users have switched to this user?

We have a system where we use different system accounts to control different environments. My standard flow looks like this: $ ssh server.example.com robin@server$ sudo su - env1-controller env1-...
0 votes
1 answer
361 views

How to add myself back into sudoers in Ubuntu 14.04?

I have just updated the software, which included replacing the sudoers file. Having noted the line in the file for myself, I expected to be able to edit it and put myself back. I was wrong - it ...
0 votes
1 answer
723 views

Running X11 over ssh does not work unless using sudo

I'm sshing from a ubuntu 14.04.1 machine into a ubuntu 14.04.3 remote machine with -X. Usually the X11 forwarding just works. But it does't on this machine. Error message: $ eog ** (eog:7733): ...
5 votes
3 answers
3k views

How can I change the root password using sudo over SSH?

I am trying to reset the root password over SSH, using sudo, as directly logging in as root is disabled. I'm using the below command to reset the password: sshpass -f .pass ssh kj@server2 'bash -s' &...
10 votes
4 answers
61k views

On Mac, how do I give myself permanent sudo privleges?

In Mac OS X 10.6, how do I give myself permanent sudo privleges? is it like linux, in the "/etc/sudoers" file?
4 votes
1 answer
6k views

Wrong permissions after sudo midnight commander

I sometimes start Midnight Commander as superuser with the command sudo mc to do some operations on the current working directory as superuser. But this results in ~/.mc having the wrong permissions,...
1 vote
1 answer
5k views

Visudo rule not working for service restart

I want to be able to restart a service in Ubuntu without being root. $ whoami ubuntu Then I did: sudo visudo and I added a line: ubuntu ALL = NOPASSWD: /usr/sbin/service ...
4 votes
1 answer
1k views

Inconsistent permissions for dnf install

Why do I not need to install as root when the shell "guesses" the package I need to execute a command? For example: (cseymour) : ~ $ dnf install rogue Error: This command has to be run under the ...
2 votes
1 answer
6k views

How to get list of all users who have sudo privileges in mac?

I can parse the contents of the sudoers file and get the information. But I am looking for a simpler solution like using some command.
1 vote
3 answers
440 views

Why does a simple user password allow root access on Ubuntu?

I have a client who I setup with a linux machine. He isn't very tech savvy, and obviously just needed a simple password to log onto ubuntu with. His username and password are something like: user: ...
0 votes
1 answer
152 views

All the command line command become "Not found" after installing Mountain lion

I just found after installing new Mountain lion, I can no longer use the command line because all the command seems to be " NOT Found", even for basic "sudo" command sudo: command not found How can ...
17 votes
3 answers
21k views

Why can't I sudo some commands? (e.g., vim)

I have sudo access on my friends server, running centos-6.3, but when I try to run some commands like sudo vim /var/www/html/index.html I get an error sudo: vim: command not found I can, however, run ...
1 vote
1 answer
81 views

Sudo does not log me in as root, but as "untitled 1"

I was changing multiple configuration files and used sudo -s to make myself root for a little while. However, after running whoami I was not root, but untitled 1. joseph@MacBook-Air (ttys000) /...
7 votes
2 answers
37k views

Running commands as another user on their machine via ssh?

As part of my normal workflow I ssh into another user's machine, switch user to them, run a command, then exit out to my own machine again: ssh hostname sudo su user runcommand exit exit Is there a ...
0 votes
0 answers
103 views

Keeping sudo across commands and shells without editing /etc/sudoers

I don't believe that my question is the classic env_keep question that sometimes crops up re. preserving environment variables across shells. I wish to preserve an exported function and exported ...
1 vote
1 answer
2k views

how to sshfs login as sudo user

I need to mount an external shared resource using sshfs. I have setup SSH authentication between my PC and the server using a local user (non-root) and it works like a charm using the following ...
3 votes
1 answer
394 views

Remember sudo password until screen lock possible?

I usually use Linux as my standard working system and I learned a lot from actually using it. For this particular question I found no answer yet. The sudo command usually remembers me typing in my ...
2 votes
2 answers
645 views

How to find which user killed my program?

I am running a long running program on a Linux server. Many other users are also running their programs on this server. All of us have sudo permissions. Assume a mischievous user kills my running ...
-1 votes
1 answer
2k views

(MAC) Are these commands to be trusted (sudo nano)?

A person asked me to do this: Open the Terminal Enter command sudo nano /etc/hosts Hit Enter Enter the password for the Administrator Hit Enter Insert the cursor in a blank line at the end then copy ...
0 votes
2 answers
287 views

How to use linux to not get crazy with root privileges

I've got a question for you today my dear Linux friends. I'm a windows user primarily. I use it for my work, watching movies, listening to music, playing games, browsing the net and everything else ...
8 votes
3 answers
34k views

What is the difference between adding a user to "sudoers" vs "root" group?

I have done some research and in order to allow the user to use the sudo command, you must add them to the "sudoers" group. This gives them root privileges as long as they enter in root's password. ...
0 votes
2 answers
6k views

Logging into sudo with a hashed password

I am curious as to whether or not I can pass the sudo password prompt the hashed sha512(?) password and log in to root that way. So it might look something like this: [user@device ~]$ sudo su - [sudo]...
5 votes
2 answers
3k views

Reboot EC2 Amazon Linux (Redhat-based) from script

I would like to reboot my Linux from a Script. The script does not run as root. Using sudo reboot produces sudo: sorry, you must have a tty to run sudo. A plain reboot gives the error ...
0 votes
2 answers
694 views

What's wrong with this configuration of sudoers file?

I have to execute a shell script as another user, but without being prompted for a password. I've edited the /etc/sudoers file with visudo, adding the following line. _www localhost=(otheruser) ...
1 vote
0 answers
195 views

Sudo access fails

When I try to execute sudo access from my account it fails with an error like suq46999 is not allowed to run sudo on vwc-1dnawap01 Server is configured in LDAP authentication Users group is ...

1
10 11
12
13 14
23