Tag Info

Hot answers tagged

18

The reason you got stuck after your edit is that the /etc/shadow file contained an entry for the password of tiny but no entry for abc, whereas the /etc/passwd file contained an entry for abc and not for tiny. When sudo looked, it identified you correctly (according to the password file) as abc based on the UID of the process you were running, but when it ...


8

If you just need to list the sudoers listed in the sudo group, I think that the best way to do it would be to run this command (which should be computationally lighter than any of the other commands in this answer): grep -Po '^sudo.+:\K.*$' /etc/group Also as suggested in the comments by muru, the format of the entries in /etc/group can be easily handled ...


6

As it stated here I consider the simpliest way to discover with -l & -U options together, just type users it will list e.g.: John then: If the user has sudo access, it will print the level of sudo access for that particular user: sudo -l -U John UserJohn may run the following commands on this host: (ALL : ALL) ALL If the user don't have sudo ...


6

Using grub2's recovery mode root shell While booting, hold Shift to access grub2's menu Select Advanced options for Ubuntu and hit Enter Select your current kernel's recovery mode (e.g. Ubuntu xx.xx x.xx.xx-xx-generic (recovery mode)) and hit Enter Select root - Drop to root shell prompt and hit Enter Run mount -o remount,rw / to remount the ...


6

What is "root"? root is a user existing on every Linux system. To be more precise, it is a special user - the super user! root is the only user that has privileges to do everything. In contrast to the two types of user accounts you can create (administrator users and restricted users), it exists by default and can neither be renamed or deleted. Usually, ...


6

If sudo and its graphical derivates gksu and gksudo are not working any more, the easiest solution is to use pkexec instead to open a command-line editor like nano and correct the wrong entries in the specific configuration files (like /etc/hosts or /etc/sudoers). Note that pkexec works for terminal applications, but needs special configuration to run GUI ...


5

As it has already been stated, the answer can be found on Unix & Linux Stack Exchange: This shows that user "saml" is a member of the wheel group. $ getent group wheel wheel:x:10:saml The only difference is that the group in Ubuntu is not wheel, but sudo (or admin in older versions of Ubuntu). So the command becomes: getent group sudo


4

You have to add the path to the sudo path. Run the command sudo visudo you will see a line like this: Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$ Now add the path of your command here and this should work. For example: $ sudo storm sudo: storm: command not found Now add the path as above: $ sudo visudo ...


4

First, edit the /etc/sudoers only with visudo You can set the permission to the user joe for apt-get command only adding the following line: %joe your_hostname=(root):/usr/bin/apt-get Once logged in as joe, you can check the permissions: sudo -l Edit: The user will be able to use apt-get update, upgrade, install, etc; since those are just flags for ...


3

Here's the default /etc/sudoers file in Trusty: # # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults ...


3

Expanding on the sudo -l -U test, one can use getent passwd to determine the users who can use sudo. Using getent allows us to access users who may not be present in the passwd file, such as LDAP users: getent passwd | cut -f1 -d: | sudo xargs -L1 sudo -l -U | grep -v 'not allowed' sudo -U does not return a non-zero exit value that we could take advantage ...


3

My initial reaction was to say it's a bad idea. However, having looked at your specific personal sudoers file, I'd say, no; it looks pretty standard for an Ubuntu system. You're not exposing any of specific software versions (that may have vulnerabilities) non-standard usernames (though if I was a bad guy, I'd be trying 'josh' or 'joshua' I quickly ...


3

You don't actually have to include your password in your script (from what I have seen its generally not advisable to have your password in a script). Instead you can edit your sudoer file to allow you to run the apt-get command without the need for a password. For more information go to this website. open a terminal (ctrl + alt + T) Enter the command ...


3

It's just your regular password. The password to run commands with sudo is your password, not a separate password. It is the same password that: you came up with and typed in when you installed Ubuntu or created your account you type in on the login screen (unless you have automatic login) you type in to unlock the screen When you're asked for your ...


3

You can use the SSH_CONNECTION and SSH_CLIENT variables: $ echo $SSH_CONNECTION 10.0.0.1 42276 10.0.0.2 22 $ echo $SSH_CLIENT 10.0.0.1 42276 22 $ SSH_IP=${SSH_CONNECTION%% *} $ echo $SSH_IP 10.0.0.1 From man 1 ssh: SSH_CONNECTION Identifies the client and server ends of the connection. The variable contains four ...


3

You can add & modify files in RW mode, and then do an OTA update, yes. However we never test this scenario, so if it doesn't work, or the files disappear, you'll probably need to cleanly re-flash the device to 'reset' back to a working state.


2

root is the user name or account that by default has access to all commands and files on a Linux or other Unix-like operating system. It is also referred to as the root account, root user and the superuser. So there will arise certain cases when you will have to be logged in as root user to run those commands. Do not worry it is simple. By default, the ...


2

Joining commands with && means that the command on the right will only run if the one on the left was successful. This means that your crontab will fail the first time it is run since there is no zip file in /var/www/html/ so the rm /var/www/html/my-zip-file*.zip fails and the mv will not be executed. So, you can either create a file of the right ...


2

!! is the syntactically simplest and probably most common expression for history expansion. As you may have noticed, after substituting the last command executed for !!, bash does two things (in its default configuration): The full command with the substituted text is shown to you. For example, if your command was lshw -c video and you run sudo !! next, ...


2

I'm going to say that, if you try to disable the root account when it's not enabled, Ubuntu will just tell you so and exit. I think that's what you're asking.


2

When you try to disable the root account but it is already disabled, passwd does not inform you that the root account was already disabled. But this is not a problem. passwd: password expiry information changed. is the expected output of a successful run of passwd -dl root, even if the root password is already disabled. As muru says, passwd commands that ...


1

Try running xhost +localhost in your terminal, and then running the command again. This lets all users on your system (i.e. root) open windows on your screen. Make sure to use +localhost and not simply +, as it's more secure to just allow connections from localhost than from anywhere. To make this permanent, edit the ~/.xinitrc file like this: Run gedit ...


1

The bash shell only reads /etc/profile when invoked as a login shell, which su does not normally do - you would need to invoke su with the -, -l, or --login option. From man su: -, -l, --login Provide an environment similar to what the user would expect had the user logged in directly. When - is used, it must be specified as the ...


1

unlink /etc/alternatives/x-cursor-theme You may also be interested in update-alternates update-alternatives --config x-cursor-theme


1

First check your $PATH variable using the echo command: $ echo $PATH If /usr/local/bin is missing, edit the hidden file .profile, located in your home directory. If this file is missing, edit .bash_profile instead. Add as very last PATH statement the following line: PATH=$PATH:/usr/local/bin


1

My answer to How do I reset a lost password (using recovery mode requires me to type the password)? also contains instructions for the related task of making a user an administrator by booting from a live CD and chrooting into your system. One benefit of chrooting is that you don't have to edit any configuration files manually, and thus are somewhat less ...


1

Answer to 1 & 2: The warning is from netstat, not from grep and its about the PID/Program name column of the netstat output: $ netstat -tapen (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address ...


1

This command returns a list of users with sudo rights: awk -F ":" '{ system("groups " $1 " | grep -P \"[[:space:]]sudo([[:space:]]|$)\"") }' /etc/passwd Output is (e.g.): <username> : <username> adm cdrom sudo dip plugdev lpadmin sambashare docker If only the user name to be displayed, then this command: awk -F ":" '{ system("groups " $1 " ...



Only top voted, non community-wiki answers of a minimum length are eligible