LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 02: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, 02:41 PM   #2
mario.almeida
Member
 
Registered: May 2008
Location: India
Distribution: Ubuntu 10.04, CentOS, Manjaro
Posts: 179

Rep: Reputation: 27
Hi,

what is the output of echo $PS1

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

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can create a .bashrc file in your root directory
containing
Code:
PS1="\[\u@\h:\W]# \[\e[0m\]"
 
Old 03-22-2010, 04:05 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
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, 03: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, 04:36 AM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
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 Aquarius_Girl; 07-28-2010 at 04:37 AM.
 
Old 07-28-2010, 04:51 AM   #7
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

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

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


Reply



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 05:19 AM
How to login telnet directly root....? saif92112000 Linux - Server 8 05-05-2008 08:16 PM
login directly to bash shell openart Linux - Newbie 5 10-27-2004 08:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:36 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
Open Source Consulting | Domain Registration