Tag Info

New answers tagged

0

The error message you displayed is not shown because some process is using sudo. This indicates that you are doing some package management for your system (update, upgrade, install....) So with regard to your demand I'm afraid to say for you that you can't do that in Linux, since the package management always demand the lock to disable other user of ...


-1

The /etc/sudoers file controls who can run what commands as what users on what machines and can also control special things such as whether you need a password for particular commands Sudo stands for either "substitute user do" or "super user do" (depending upon how you want to look at it). What sudo does is incredibly important and crucial to many Linux ...


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


0

You can do this by editing your sudoer file. Open a terminal (ctrl+alt+T) enter the following command sudo visudo Once the file opens enter the following command username ALL=(ALL) NOPASSWD: /path/to/command Replace username with the your own username You can find the path to the command by running which command For more information on editing ...


-1

Yes. Some may recommend marking the script as setUID and owned by root. I would discourage this. Instead, put the user under whose ID the script will run into the sudoers group and configure sudo to allow that user to run the specifically required commands as root without requiring that user to enter a password. This provides audibility and keeps things ...


-1

If it's your computer and if you are only one user, the password should be the same as login password. Otherwise it will be predefined password either from another user or Ubuntu


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 ...


0

getent group sudo | grep your-user-name If you find your username among the list from command above then you are a sudo. To use a sudo with no password which is not advised at all and make you in risk to hurt your system Open terminal window and type: sudo visudo In the bottom of the file, type the follow: username ALL=(ALL) NOPASSWD: ALL


0

To make those aliases available for root, you can put them into /root/.bash_aliases. However, if you just need to run those aliases as root from your user, you can just put them into ~/.bash_aliases and add sudo at the start of each alias' command: alias startapache="sudo /usr/local/Cellar/httpd22/2.2.29/bin/apachectl start" alias stopapache="sudo ...


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

Try running xhost + in your terminal, and then running the command again. I can't reproduce your problem on 14.04, but this has worked for me in the past when sudo / gksu threw this error.


0

Try this script: #!/bin/bash echo "yourpassword" | sudo -S apt-get update echo "yourpassword" | sudo -S apt-get autoremove Here, you echo your password and the read the password using -S option (stdin option for sudo).


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 ...


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, ...


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

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 ...


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 ...


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.


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 ...


0

I would advise you not to publish anything in a public repository, which is located in the /etc directory. This information will make you vulnerable in the worst case. The risk that you overlook a file containing sensitive data is too large. Maybe it's enough if you only commit the data, but do not push. Then the changes are saved locally.


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 ...


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 ...


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 " ...


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 ...


0

I think you have created the alias in the user level. That's why the shortcuts are available at the user level only. You should add that alias command line to .bashrc file in /root folder and not in /home/user/.bashrc(this .bashrc file belongs to user account not root). So that you can use your alias command directly in shell when logged in as root.


0

Cut out and reworded from @MyUserIsThis' edits to his question: Ok, I chowned recursively the whole directory /home/<user>/.matlab so I would have permissions to write on it and it was fixed. BTW, in case someone else runs into this, the exec line of the desktop file should include the option -desktop for the script to work properly when not called ...


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 ...


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 ...


0

First of all look for permission-related errors with: strace monodevelop. If you found it, change the permissions to that files/directories to match your user. It also helps if you delete every monodevelop-related directories from userspace.


1

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


0

Which version do you use? Are you using proxy? Try digging here and here EDIT: To use apt-get through a proxy, I do the following - sudo apt-get --print-uris install PROGRAM This prints the urls of the packages, so you can download them. For example, using supertux: wilf@comp:~$ sudo apt-get install --print-uris supertux Reading package lists... ...


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.


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 ...


0

The line is bellogs to error output, i.e. sterr. You could get rid of it with netstat -tapen 2> /dev/null | grep ssh For reference check this As properly noted by heemayl , without sudo, netstat won't report that connection is established by the ssh server, only if it's established by ssh client. Of course, you can still determine it by port number ...


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 ...


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, ...


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 ...


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 ...


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 ...


0

Use: vipw I have always used this on FreeBSD and just confirmed you can use it for Ubuntu too. Please read this page: Ubuntu Man Page for vipw


0

So far I've had success making bash aliases for emacs and sudo. Edit your ~/.bashrc (or ~/.bash_aliases if you use that) to include the following: alias emacs="emacs -nw" alias sudo="sudo " I'm still disappointed that the latest emacs-nox doesn't just work out of the box. Update: I found I had not properly removed the old version of emacs. Make sure when ...


0

If you want to use su instead of sudo, I believe you can use something like this: su - <username> -c "<commands>" - will simulate a login of the specified user -c tells it that you want to run a command ps. Unfortunately I'm not able to install ruby using rvm with this method, but that's probably not related.


-4

procedure for changing your username (but not uid) by hand: have your head examined, when that fails proceed to step two. edit shadow file duplicating the user line with new username. edit groups, sudoers, allowing new username permissions, keep old symbolically link home directory to new name edit passwd file changing username and home directory edit ...


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 ...


21

You must NEVER edit your passwd file manually because you will mess things up. The proper way to change your username is: usermod -l newUsername oldUsername Then change home folder: usermod -d /home/newHomeDir -m newUsername To change password you should use: sudo passwd yourusername I suggest you to revert your passwd file back, or if you can't ...


4

It appears you made a mistake (or followed bad instructions) while attempting to add a software source for libdvdcss. Since your libdvdcss.list contains nothing of value--just terminal commands, where instead there should be deb lines--you can simply delete that file, then update the package manager's information about available software: sudo rm ...


1

The /home folder needs to have its execute permission restored Restart Ubuntu Run recovery mode in root (Recovery mode how to) Run the find commands to restore permissions Resetting /home permissions Run both the commands below found from z9.io For directories only do this find . -type d -exec chmod 775 {} \; For files only do this. ...


2

As bodhi.zazen says, you should boot to recovery mode and change the permissions back. Recovery mode should still work fine--this change is unlikely to render it unusable--but if for any reason you cannot use recovery mode, you can use a live CD/DVD/USB. Hold down shift while booting so the GRUB menu is shown. Select Advanced options for Ubuntu, then select ...



Top 50 recent answers are included