LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-09-2012, 01:10 AM   #1
azzi
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
Question Linux Prompt user/Greeting


Hi,
I can't seem to get this right.
Lets say I have root privileges and I wanted:
a ) edit the user prompt to show "linux1234$" whenever they log-in.
also
b ) Show a message for users upon logging in.

I know a) has something to do with editing PS1. but how to only apply the change for users?

b ) I know there are or is a file that will enable me to accomplish this, but which or what are they?

I'm pretty new to this, so any help or guidance will be appreciated.

Thanks in advance...
 
Old 11-09-2012, 08:34 AM   #2
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Linux Mint, Ubuntu
Posts: 1,506

Rep: Reputation: 325Reputation: 325Reputation: 325Reputation: 325
Here's where I'd start:
For individual users, ~/.bashrc.
For everyone, /etc/bashrc (or /etc/bash.bashrc, depending on distro)
 
Old 11-09-2012, 09:31 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
(1) In order to set user prompt, add following 2 lines at the end of /home/<user>/.bashrc file as follow (for bash):
Code:
prompt="linux1234$"
export prompt
For c shell or ksh, do change the syntax to set prompt="linux1234$" and append the same in .cshrc or .kshrc file. Also if 1234 is command number, then use, prompt="linux\!$"

(2) To set a greeting message, just add your message in /etc/issue or /etc/motd file.

Last edited by shivaa; 11-09-2012 at 09:33 AM.
 
Old 11-09-2012, 10:09 AM   #4
evgenyz
Member
 
Registered: Sep 2012
Posts: 48

Rep: Reputation: Disabled
There are actually 2 questions:
How to set prompt and how to shoe some message to the user.
There is simple script /etc/profile.d/myenv.sh:
PS1=`hostname|cut -d. -f1`:'['${USER}']''$PWD: '
HISTSIZE=10000
export PS1 HISTSIZE
if [ "$TERM" != "dumb" ]; then
if [ -f /etc/motd -a -s /etc/motd ]; then
cat /etc/motd
fi
fi


Then you can update /etc/motd if you want it to be shown at login time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
greeting to linux community lami's Linux - Newbie 2 10-11-2012 03:09 PM
greeting linux user... dudastt LinuxQuestions.org Member Intro 1 02-07-2012 08:30 AM
Greeting to you all LQ User..... crytek80 LinuxQuestions.org Member Intro 2 09-24-2010 06:45 AM
SMB, user prompt , I can not conect to linux from windows. fabianCastle Linux - General 3 05-05-2003 09:12 PM
Sending Greeting mail to new user ranjit001 Linux - Networking 1 01-03-2001 12:58 AM


All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration