Multiple Questions - can't find answers anywhere
Hi All,
I need the following information: - When using SU - , I need the option to show the full user path (root user, home dir, etc..), not just root@name. Is there one? -If not in sudoers file, how can a user get in to edit a file for example. Is that possible? -Does service ssh restart disconnect users? Thanks greatly! |
Quote:
edit ~/.bashrc and add the folling line at the end: Code:
export PS1="[\u@\h:\w]\$" Quote:
Quote:
|
In regards to your first question I believe you should look at the man page for whatever shell you are using under prompting. For instance in BASH you can change the prompt by setting $PS1 to different things.
If a user is not in the sudoers file they can su root if they have the root password to switch to the root user and perform administrative tasks requiring such privileges. Restarting ssh will disconnect users. Hope this helps. |
answers (or some of them)
Morgandy,
The default prompt comes from the PS1 environment variable. You could do set this in this way: Code:
su Code:
chmod u+x /home/john/shellPrompt Up there in the line that starts with "PS1", is a "\u" for user, "@" which is a string, "\w" working directory, "\h" for hostname. You can leave the h out if you want or add "\t", "\d" date and time. The "\" is nessecary as an escape character. If you don't put the \ in there your prompt will look like this Code:
u@wh# As to the SU question, you can edit any file that you have permission to, unless you have the root password, then you can edit any file on the machine! I do use "sudo" occasionally, but SU is better because you don't have to type "sudo" every time you want permission, there is no limit to SU's permission. If I want to edit a file in a graphical text editor I type Code:
sudo gedit fileName Code:
SU Hope that helps. |
Note that Linux is case sensitive, so the cmd is su not SU.
Also, su - gives you root's env su (no '-') logs you in as root, BUT with your orig env... Actually, you can switch to any user via su, if you know the passwd. It just defaults to root if you don't specify one. |
Quote:
In KDE: Code:
kdesu kwrite whatever file name Code:
gksu gedit whatever file name |
All times are GMT -5. The time now is 01:54 PM. |