LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 03-22-2010, 03:06 PM   #1
prasadshetty
LQ Newbie
 
Registered: Jul 2009
Location: Mumbai
Posts: 3

Rep: Reputation: 0
root login directly into -bash-3.2#


Hi all,
i am using fedora 10
while i login as a normal user its working fine username@hostname
while i login as a root user it goes directly into -bash-3.2#
if i check pwd it shows /root
till now i am not facing any problem as i am using as a normal user
but how can i change -bash-3.2# to root@hostname
which file and where to edit
 
Old 03-22-2010, 03:41 PM   #2
mario.almeida
Member
 
Registered: May 2008
Location: India
Distribution: Ubuntu 10.04, CentOS
Posts: 179

Rep: Reputation: 27
Hi,

what is the output of echo $PS1

you can also type bash and enter
 
Old 03-22-2010, 03:44 PM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
You can create a .bashrc file in your root directory
containing
Code:
PS1="\[\u@\h:\W]# \[\e[0m\]"
 
Old 03-22-2010, 05:05 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,542
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

You could setup a .bashrc & .bash_profile for your user;

Code:
sample .bash_profile;

~$ cat .bash_profile
# .bash_profile
#08-30-06 12:21
#
# Source .bashrc
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
Code:
sample .bashrc;
:~$ cat .bashrc

#.bashrc
#08-30-06 12:20 

# Add bin to path

export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"

#export PATH="$PATH:$HOME/bin"

# Dynamic resizing
shopt -s checkwinsize

# Custom prompt
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

#08-29-06 11:40

if [ `id -un` = root ]; then
   PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
 else
   PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '
fi

#
# Add color
eval `dircolors -b`

# User defined aliases
alias cls='clear'
alias clls='clear; ls'
alias ll='ls -l'
alias lsa='ls -A'
alias lsg='ls | grep'
alias lsp='ls -1 /var/log/packages/ > package-list'
alias na='nano'
alias web='links -g -download-dir ~/ www.google.com'

#08-29-06 11:50

#To clean up and cover your tracks once you log off
#Depending on your version of BASH, you might have to use
# the other form of this command
   trap "rm -f ~$LOGNAME/.bash_history" 0

#The older KSH-style form
#   trap 0 rm -f ~$LOGNAME/.bash_history
The .bashrc is very useful! I like to use the .bash_profile to test then use the .bashrc.
 
Old 03-24-2010, 04:03 PM   #5
prasadshetty
LQ Newbie
 
Registered: Jul 2009
Location: Mumbai
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mario.almeida View Post
Hi,

what is the output of echo $PS1

you can also type bash and enter
[prasad@localhost ~]$ echo $PS1
[\u@\h \W]\$
 
Old 07-28-2010, 05:36 AM   #6
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Quote:
Originally Posted by prasadshetty View Post
but how can i change -bash-3.2# to root@hostname
which file and where to edit
Read the following links:
http://www.linuxselfhelp.com/howtos/...t-HOWTO-2.html

http://tldp.org/HOWTO/Bash-Prompt-HOWTO/

Did you bother to read the Post number 3 and 4 ????
Did you bother to thank the above people who have tried to help you ????

Last edited by TheIndependentAquarius; 07-28-2010 at 05:37 AM.
 
Old 07-28-2010, 05:51 AM   #7
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 111Reputation: 111
copy files from skel to /root.

Code:
cp /etc/skel/.* /root
HTH
 
  


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
unable to login directly by root aloneattack Linux - Security 10 11-20-2008 06:19 AM
How to login telnet directly root....? saif92112000 Linux - Server 8 05-05-2008 09:16 PM
login directly to bash shell openart Linux - Newbie 5 10-27-2004 09:05 AM


All times are GMT -5. The time now is 12:58 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