New answers tagged

1

(I know I shouldn't comment in an answer, but not enough reputation to comment.) blade19899's answer worked for me except for symlinks. E.g. it applied 755 to /bin/bash, but then applied 777 to the symlink /bin/rbash, effectively 777-ing /bin/bash. As I already had the fileper.log file, I just modified the destination-end command: while IFS=: read -r -d ''...


1

The principle behind the www-data user is that it is an unprivileged user. When you run a daemon (background program like a web server), for security purposes it is good for it to drop privileges after starting, so that it spends the rest of its time with the lowest privileges possible. In the past the nobody account was often used for this purpose. The ...


2

Under no circumstances permit your web server to run commands with sudo. Not even hyper-specific commands. This is a huge security risk. A web server should not be given permissions to access sudo commands, which then permit root access for commands. Especially when given nopasswd form of sudo, should your web server be breached, any command run by a ...


0

There are actually two mechanisms set up in Ubuntu for performing administrative tasks. sudo is one of them, and it and its graphical frontends (like gksu and gksudo) are not going to work until you fix the permissions problem. The other mechanism is PolicyKit. Depending on exactly what you have done to your file permissions, it's likely that you can still ...


1

I solved this, by using gksudo in desktop files, like this: [Desktop Entry] Type=Application Exec=gksudo /home/kiosk/.config/autostart/serve.sh Hidden=false NoDisplay=false X-GNOME-Autostart-enabled=true Name=Serve I dont know why this worked though, if anyone knows, please tell.


1

Of course. I never even have to use "sudo" with using "scp". Mind though: as with all remote copy-ing the servers need to be setup to allow it. You can even use "scp" without having to use a user and without providing a password if you want.


0

In my case, it was because the entry for that user was missing in /etc/shadow. I had copied to another test server all entries in /etc/passwd with ID higher than 1000 along with /etc/group but forgot /etc/shadow. So everytime I did su with any of those users I would get that error. After adding the missing entry in /etc/shadow the error would stop appearing....


1

The library is available for all Ubuntu versions http://packages.ubuntu.com/search?keywords=commoncpp&searchon=names sudo apt install libcommoncpp2-dev Provides /usr/lib/x86_64-linux-gnu/libccext2.a /usr/lib/x86_64-linux-gnu/libccext2.la /usr/lib/x86_64-linux-gnu/libccext2.so /usr/lib/x86_64-linux-gnu/libccgnu2.a /usr/lib/x86_64-linux-gnu/libccgnu2....


0

Try to change its permissions in terminal. You could make it executable only by by a certain group, such as wheel or admin. Sadly (or perhaps fortunately), a file can only have one group ownership so chown simply wouldn't work by itself. Try "sudo chown root:wheel /sbin/shutdown" and then "sudo chmod g+x /sbin/shutdown". This will make the file executable ...


0

you would have to alter the sudoers file (or add a new file to /etc/sudoers.d/) to allow user "user" to execute this script without password: user ALL=(ALL:ALL) NOPASSWD: /home/user/Desktop/script.sh if you do not want to execute the whole script.sh as root, you need to mention all commands within the script.sh that you will be prepending with sudo. it's ...


0

In addition to sudo, you might also need to disable X access control within your user X session: xhost + sudo foo ... sudo bar For foo and bar being X applications. But I agree with everybody: don't do that!


2

The permissions on your $HOME directory are incorrect. You can fix it by typing chmod u+w $HOME. Notice that the files and directories you created using sudo are probably owned by root now, so, you will need to fix ownership on these. You can do it by using sudo chown logandark.logandark <file or directory name>. EDIT: To change ownership ...


1

Ubuntu comes with sudo by default. sudo is a package/command that allows you to run any command/application as root (sudo stands for SuperUser Do). Your user is by default in sudoers file if you are administrator (who installs the system, per example). Simply type: sudo <command> Example: sudo gedit This runs gedit as root. BE EXTREMELY CAREFUL ...


2

Fortunately this question has an answer that works. Using the root account is insecure and I understand that. The accepted answer there is going to help me a lot. Thank you for your suggestions, criticism, and help, bobbyblackblech, Pilot6, Serg, and Parto.


3

You may add your very own User with sudo rights. You can create a User and add this User to the sudo Group. sudo adduser youruser sudo Or if you already have a user, you can add this to the sudo Group. sudo usermod -a -G sudo youruser After this log in to this user with su youruser and try to run the installation again with sudo yourinstallcommand. ...


2

Sometimes running a process from root's crontab may cause issues with initial file ownership and rwx mode; those may not be correctly preserved. In any case: 1) to create a new user, keep it simple: $ sudo deluser my-user # if "my-user" is a regular user $ adduser my-user $ sudo gpasswd -a my-user sudo 2) to include a new entry with a NOPASSWD tag ...


1

If you want to do it in an alias, you have to use alias redo='sudo $(history -p !!)' for some reason.


1

So I have already found the solution: sudo -u test2 bash


2

To prevent switching users by sudo su -, you need to disable root's ability to su to any user. Edit /etc/pam.d/su and comment this line: auth sufficient pam_rootok.so As the comment above this in /etc/pam.d/su says, this allows root to su without passwords. Or you could restrict sudo usage to a limited set of commands which don't include su and ...


0

A little script to cover both cases [server running/server not running]: #!/bin/bash service mysql restart if [ "$?" != "0" ]; then service mysql start fi


0

Sudo privileges should only be given to those who may need to administer the machine itself. Other privileges can be managed through groups and group privileges. For instance, add user named 'developer1' to the www-data group: sudo usermod -a -G www-data developer1 This will add 'developer1' to Apache's www-data group. sudo chgrp -R www-data /var/www ...


1

You might want to think about why the members of the 'client' group can access root privileges in the first place. As far as sudo is concerned, those user's privileges are defined in the sudoers file, that you can edit with visudo (provided you have the neccessary privileges yourself). The sudoers file can be seen as a whitelist: Only those privileges ...


4

sudo is a command and it is an executable program. You can find out more about how to use it using these commands in the terminal (in order of least -> most detailed): sudo --help man sudo info sudo To understand more about how it works, you can visit the sudo website where you can browse the source code. You can also download the source code: ...


4

Welcome to Security Whack-A-Mole, the game where you try to enumerate ALL the ways you can get hurt, and try to wrap each one in bubble wrap. You can never win. Rather, learn to use Unix/Linux tools, understand what your system does, and don't run scripts (or anything) you don't understand (that comes from an untrusted-for-system-upgrades source). Your ...


0

You can make a script that checks if user is running it with root permissions or not. Then it will run systemctl command or return error. #!/bin/bash if [ "$(whoami)" != "root" ]; then echo "Sorry, you are not root." exit 1 else (systemctl shutdown command) fi Source


0

The solution is: Give docker the rights to access the X-Server with: xhost +local:docker


1

Nice one-liner to remove sudo prompts for the current user sudo bash -c 'echo "$(logname) ALL=(ALL:ALL) NOPASSWD: ALL" | (EDITOR="tee -a" visudo)'


-1

It's pretty obvious that your user is not in the sudo group. You didn't provide any additional information like, are you the only user of that computer? If you are not, then ask/use a sudo account to add your account to the sudo group. However, it's also possible that there are no sudo users on your system at all (pretty rare). If you have accidentally ...


-1

As indicated in the other answers, you need to be in the sudoers group. If you are, the sudo password is the same as your login password.


0

I am guessing your account doesn't possess superuser privileges. You cannot recover password from terminal by any command. If you need to do perform any administrative tasks, you should consider contacting your IT support for the root access. Also, you might want to edit the description of your question to make it look more professional.


3

It is a design feature that since 16.04 you do no longer need root privileges to shut down or reboot the system through any method. Instead the systemd and its systemctl tool accept those commands from regular users. All related commands like shutdown, reboot, halt, poweroff are symbolic links ("symlinks") to /bin/systemctl and init is a symlink to /lib/...


7

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


2

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



Top 50 recent answers are included