New answers tagged

6

First of all, never edit /etc/sudoers manually, always use visudo. Your problem was a syntax error in the file /etc/sudoers.d/90-cloudimg-ubuntu but it is now a malformed /etc/sudoers. So, to fix it (now that you have removed any changes you may have made), run pkexec visudo and make the file look like this: # # This file MUST be edited with the 'visudo' ...


1

Replace sudo with gksudo -- in your script, like this: gksudo -- sh -c "sync; echo 3 > /proc/sys/vm/drop_caches" That will open a simple dialogue window to ask for your password instead of prompting you for it on STDERR which is not connected to a terminal if you run the script from your desktop. On newer releases of Ubuntu, gksudo might not be ...


1

You had a NOPASSWD rule applied to your user in some file in /etc/sudoers.d. Use sudo grep NOPASSWD /etc/sudoers.d -R to find out which. Your /etc/sudoers is not the default, however. The default sudoers can be obtained by looking at the sudo package: $ apt-get download sudo Get:1 http://mirror.cse.iitk.ac.in/ubuntu xenial-updates/main amd64 sudo amd64 1.8....


0

That error shows up if you changed host name and /etc/hosts was not changes. /etc/hosts will have 7 lines. You need to alter the 2nd word on the 2nd line to 127.0.0.1 linux98. You will need to use a live session since /etc/hosts needs sudo to be able to save changes (sudo nano /etc/hosts) and if sudo complains ... not going to work.


-1

You can pass the password to sudo from the standard input, like this: echo 'yourpassword' | sudo -S yourcommand Using -S tells sudo to read the password from stdin, which comes from the echo 'yourpassword' bit. You could also edit visudo, so that sudo will never prompt for the password, either only for your specific comand, or always. Warning: storing ...


0

I just had similar problem. I'm using Debian Jessie and to start gedit as root this line was then finally working: sudo -H gedit


0

Some terminal emulators will not update prompt with the correct hostname until you close and restart the emulator (lxterminal, I'm talking to you). I spent 30min fighting with this error after editing my hostname and hosts files and running sudo service hostname restart until I ran sudo hostname and saw that the hostname was the new value, even though the ...


0

This happens when you messes up with your hosts and hostname. No worries I myself had this problem and solved it. Just follow the steps below. First check your hosts. For doing so key the following in your terminal: " cat /etc/hosts " - You should get the following. ""Forget the IPv6 parts and just focus on first 2 lines"" They should look the way ...


0

I think the better way is to use gksu nautilus command and you can copy whatever you want with common GUI as usual.


1

Edit your sudoers file using sudo visudo. Find this line: Defaults env_reset and change it to this: Defaults env_reset,timestamp_timeout=0 This forces sudo to ask for a password every time your run it.


0

Login with root (su) and run the following command chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo


1

You're correct that root has all privileges, but saying that sudoers have all privileges is not quite correct. They are allowed to attain all privileges by using sudo to run a command as root. That includes running a root prompt, using a command like sudo -i. root is not a sudoer because it is already root - it doesn't need to become root to run commands.


4

The only way to undo that would be a tedious by hand process for which you would need to know all the files original permissions. Save yourself the headache, Use a live USB/CD in conjunction with an external drive to backup your /home folder and do a clean fresh install.


0

Hi just follow this steps: set android vars Initially go to your home and press Ctrl + H it will show you hidden files now look for .bashrc file, open it with any text editor then place the lines below at the end of file: export ANDROID_HOME=/myPathSdk/android-sdk-linux export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools reboot using ...


5

What does the root and # mean in the second command line tag? It means you edit the system as "root". That is 1 more level up than from "sudo" and 1 more up from your normal users activities ... what does this mode allow you to do ... and (almost) all permissions checks are neglected. So if want you can seriously destroy your system with a single ...


-1

By and large it's mainly a strategic difference. If you're logged in as a super user, you can change anything all the time ... ie - there's no protection against catastrophic mistakes, you'd have to temporarily change to some other user for safety. Whereas: if you're logged in with limited privileges, you avoid some risk of catastrophic mistakes, because ...


1

The error message sudo: /etc/sudoers is owned by uid 1000, should be 0 means you should change the ownership of /etc/sudoers from you to root. You cannot run sudo until it's fixed. Can you boot to single-user mode, mount / r/w, then chown -R root /etc/sudoers I didn't use sudo because single-user mode is already root (UID 0). I used the -R to affect /etc/...


0

This rule should be sufficient to achieve passwordless restart of network manager. However: Do you run command exactly as you wrote it in sudoers file? For example you can not omit .service part unless your sudo rule looks like this: %sudo ALL=(ALL) NOPASSWD: /bin/systemctl restart network-manager* Does sudo --list command output includes your command?...


4

Instead of doing su root, you should use sudo instead, as the root account is not enabled by default in Ubuntu, and will not work. This is why you are getting an "Authentication failure" message. Regarding password entry - it won't show you anything as you type, but, it will accept your password after you press enter. Make sure you entered the right ...


2

I solved the problem by going to All Setting > Details > Device Name changed the device name to kaushal Just make sure that your /etc/hostname file has only your machine name.For my case it was kaushal


1

I will answer your question specifically In your /etc/hosts for localhost change 127.0.0.1 kaushal to 127.0.1.1 localhost localhost.localdomain kaushal


0

I have a different solution whereby you do not need to add sudo as an alias. I run Linux Mint 17.3 but it should be pretty similar to Ubuntu. When you are root, then the .profile is run from its home directory. If you do not know what the home directory under root is, then you can check with: sudo su echo $HOME As you can see, the home of root is /root/. ...


1

No, this line is not a valid line in /etc/apt/sources.list. Just remove it.


0

boot into recovery mode Select root Press enter to continue Type chmod 755 /usr/bin


0

You obviously can access the internet on another machine because you posted this question. You can create an Ubuntu live CD, boot into it, and fix sudo with the following steps. Mount the partitions of your installation to recreate the filesystem at /mnt (sudo mount /dev/<whatever> /mnt, mkdir -p /mnt/home && sudo mount /dev/<whatever2> /...


2

In order to fix this, you can either reinstall sudo, or download a default /etc/sudoers and edit it. Both ways require these steps: First, restart your computer. When the Grub screen displays, instead of choosing Ubuntu xxx, choose Advanced options for Ubuntu xxx. Under Advanced Options, choose Recovery mode. The second step is to mount your partitions rw. ...


0

Looks like your linux bos is trying to resolve the hostname which is not setup in your hosts file. If you type the word hostname should print the actual host name setup. sudo nano /etc/hosts #opens the file for editing 127.0.0.1 myhostname #add this to the file and Ctrl+O to save, Ctrl+X to exit That should sort you out but you can also trace the syscall ...


2

Maybe there is something wrong in your host file. You can read it by using. cat /etc/hosts EDIT: it has to match your /etc/hostname


14

SSH starts a login shell. su, by default does not. In particular, this means that the ~/.profile (or similar file) for that user is not sourced. So changes made in ~/.profile won't take effect. It might also be the case that: even if you start a login shell, different changes were made in root's ~/.profile, which might pollute the user's environment. /...


0

From doing a quick search, I think the answer is that Ubuntu does not actually have a guest account, it uses a "guest session". Guest sessions cannot make any real changes to a system, so if you log on and try to save a file to the sessions home directory, when you log out, those files are removed. You can almost think of a guest session as a live USB/CD ...


1

cannot create regular file ‘/var/student’: Permission denied "/var" and/or "/var/student" is owned by "root" or another user than you are using to copy the file or "student" does not exist. Make sure "student" is a directory and exists. If it does not the system will try to copy a file into "/var" and name it "student" or replace the file and you need ...


0

Go to terminal and type: sudo su - apt-get install openssh-server openssh-client Test the installation ps -A | grep sshd If the output is something like this: <some number> ? 00:00:00 sshd Then ssh daemon is running. Again type in terminal; ss -lnp | grep sshd If the output is something like this: 0 128 :::22 :::* users:(("sshd"...


3

sudo sanitizes the environment before running any command. In doing so, if the value of the directive secure_path is set, it will be used as the PATH for the sudo commands, not the current PATH. In my system: % sudo grep -E 'secure_path' /etc/sudoers Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" So i have: % echo ...


1

You might want to learn to use ddrescue. Enable the univers-repository (if you haven't allready) and install it with: sudo apt-get install gddrescue Using ddrescue is much less error prone and thus less dangerous. Also it features neat things like a progress bar.


5

Put the following into /usr/bin/dd: if [[ "$*" != *"of=/dev/sda"* ]]; then /bin/dd "$*" else echo "You are not allowed to set dd output to /dev/sda!" fi NOTE: If, in case, you ever need to actually use dd on /dev/sda, use sudo /bin/dd [Arguments for dd] To downvoters: The issue pointed out by @Gilles (Thanks!) has been fixed now, no need to ...


6

Running commands with sudo is inherently dangerous because of the rights that come with it; therefore use it judiciously and with care. The best way to stop bad things happening is to think twice and act once.


0

It seems you wrong default shell setup for the root user. In 1st command sudo -i, you passed the login authentication but no shell run. In 2nd command sudo -s, you are already passed sudo authentication which it you are only asked onces per terminal (may be it has a timeout period). However this time, it loads directly /bin/bash not shell set in the root ...


2

This would do it. n=5 p="password" u="username" for (( c=1; c<=n; c++)) ; do d=$p$d ; done echo $u":"$d | sudo chpasswd the sudo part is not necessary if you're running this as root.


0

You can just use sudo -i Then just enter your password to get root privilege.



Top 50 recent answers are included