LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to set up su message (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-set-up-su-message-905736/)

Timothy.u 09-30-2011 01:18 AM

how to set up su message
 
Hello,

I would like to set up su message on my linux machine, I'm running archlinux. This is an example of what I want:
user@machine:su
password:******
Super user mode is enabled
root@machine:

16pide 09-30-2011 03:20 AM

how about this:
Code:

sudo bash

Timothy.u 09-30-2011 04:02 AM

This would only invoke bash with root. I checked man pages of bash, but it doesn't seem to be anything in there or maybe i just couldn't see it.

rhowaldt 09-30-2011 04:25 AM

don't know if there is a dedicated place for doing this, but it should probably be possible to do this through a bash function? (so a function in your .bashrc) something like this (not on Linux now so can't test it):

Code:

function su() {
  su
  echo "Superuser mode is enabled"
}


Nylex 09-30-2011 04:31 AM

I don't think that will work, as the echo statement will only be executed once su has finished.

zk1234 09-30-2011 04:51 AM

Quote:

Originally Posted by Timothy.u (Post 4486202)
Hello,

I would like to set up su message on my linux machine, I'm running archlinux. This is an example of what I want:
user@machine:su
password:******
Super user mode is enabled
root@machine:

I think there is a small mishmash in your question. If you want to enable super user mode permanently than you should just log in as root. The su command has been created to execute something as root, but without permanent enabling su mode.

Timothy.u 09-30-2011 05:08 AM

I'm sorry, maybe I did not make it clear, what I need, at that moment when I log in as superuser, I want a message to be prompted, how can I add or edit that message?

rhowaldt 09-30-2011 05:15 AM

many people set up something like this through their bash prompt. so for example your regular prompt would be this:
name@linuxbox $

and your root prompt would be this:
name@linuxbox #

when you add colors, put the root one in red so it distinguishes itself.

i know this is not what you are asking, but it accomplishes the same goal.

snooly 09-30-2011 05:17 AM

In the file /root/.bashrc add a line:

echo Super user mode is enabled!!!!!!!!1

Timothy.u 09-30-2011 05:20 AM

Thanx, that worked. P.S. I had to create that file myself, it wasn't there

snooly 09-30-2011 08:36 PM

Quote:

Originally Posted by Timothy.u (Post 4486309)
Thanx, that worked. P.S. I had to create that file myself, it wasn't there


The .bashrc file is optional. It's handy to have one and put aliases and things in there. For example, you could put alias ll="ls -la"

Timothy.u 10-02-2011 11:57 PM

Quote:

Originally Posted by snooly (Post 4486837)
The .bashrc file is optional. It's handy to have one and put aliases and things in there. For example, you could put alias ll="ls -la"

Yeah, I checked out ordinary users .bashcr and I found a lot of interesting stuff there :)


All times are GMT -5. The time now is 03:22 PM.