New answers tagged su
su-to-root is simply a GUI front end for su. If you're comfortable in the terminal, then using sudo should work fine. For more information: http://manpages.ubuntu.com/manpages/intrepid/man1/su-to-root.1.html
You can change users using su like follows: root@bacon [~]# whoami root root@bacon [~]# su - cataline cataline@bacon [/root]# whoami cataline May need to use sudo to run the command depending on permissions. EDIT Changed command to reflect creating a login shell
Nothing's wrong. You were logged in as a root user. When you exited, your session was closed - but you opened this session as a user, so you get back to your user account. It's kind of like opening full screen game - you open it from your desktop, and it looks like it took over your PC - yet when you close it, you go back to desktop - the place of origin - ...
Use the man page: -m, -p, --preserve-environment Preserves the whole environment, ie does not set HOME, SHELL, USER nor LOGNAME. So running 'su -m ' as root will make bash to read ~/.bashrc which expands (due to preserved environment) to /root/.bashrc which you have no rights as user. Your /etc and /etc/bashrc permission are wrong also, it ...
The problem is your permissions for /etc. These must be 755, not 754. The full error text is as follows: su -s /bin/bash -m roaima Password: _ bash: /etc/bash.bashrc: Permission denied I have no name! This shows that the system is struggling to read /etc/passwd to derive the details of your home directory, full name, etc. Fix the permissions on /etc and ...
A way to do this would be to just execute su at the beginning of the script. The user enter the root password only once at the beginning of the script. You can then execute commands without root privileges by doing su [username] -c [your command not to be executed with root privileges]. However, you can't use dialog boxes to ask for the password here.
What you may be looking for is the setuid/setgid flag. When set on an executable, the executable is run with the permissions of the executable's owner instead of the user making the call. Here's a wikipedia article about it BE CAREFUL WITH THIS. If you set this on a bash script and allow write permissions on the script, you are basically allowing anyone ...
Top 50 recent answers are included