LinuxQuestions.org
Help answer threads with 0 replies.
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 09-24-2012, 11:23 AM   #1
tar1827
LQ Newbie
 
Registered: Jun 2007
Location: West Michigan, USA
Distribution: Fedora
Posts: 9

Rep: Reputation: 0
Bash prompt issue when logging in via SSH


I'm wondering if someone can shed light on this for me:

When I log into my Fedora17 box using SSH as the user "tommy", I get an unexpected command line prompt from bash. When I SSH in as "johnny" I get a more conventional prompt. I looked at the files .bashrc and .bash_profile in each user's home directory to see if I could identify what is different; however, they appear to be the same. I don't see where else the prompt variable is set. Normally, I use "tommy" as the user account that I remotely access via SSH. This prompt is not helpful to me.

Below is the output I get from Putty when I log in as each user.
Code:
Using username "tommy".
tommy@my.domain.net's password:
Last login: Mon Sep 24 11:59:29 2012 from c-111-2-333-44.some.isp
-bash-4.2$
Code:
Using username "johnny".
johnny@my.domain.net's password:
Last login: Mon Sep 24 11:59:57 2012 from c-111-2-333-44.some.isp
[johnny@server ~]$
 
Old 09-24-2012, 11:40 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
post tommy's .bashrc?
 
Old 09-24-2012, 11:51 AM   #3
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106

Rep: Reputation: Disabled
I think tommy user's login shell is set to /bin/sh instead of /bin/bash.
Code:
grep tommy /etc/passwd
If login shell of tommy is not set as /bin/bash, then you change it to /bin/bash using chsh command
Code:
chsh tommy
Changing the login shell for tommy
Enter the new value, or press ENTER for the default
	Login Shell [/bin/sh]: /bin/bash

grep tommy /etc/passwd
tommy:x:1003:1003::/home/tommy:/bin/bash
Or simply run "bash" command after logged in as tommy user.

Last edited by mandyapenguin; 09-24-2012 at 08:41 PM.
 
2 members found this post helpful.
Old 09-24-2012, 06:43 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by mandyapenguin View Post
I think tommy user's login shell is set to /bin/sh instead of /bin/bash.
Code:
grep tommy /etc/passwd
Man, I must be stuck in a time warp, or a mental ward.
Why do I assume everyone uses bash? </rhethorical_Q>

Thanks mandyapenguin!
 
1 members found this post helpful.
Old 09-24-2012, 08:52 PM   #5
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106

Rep: Reputation: Disabled
Quote:
Habitual;4788413]Man, I must be stuck in a time warp, or a mental ward.
Why do I assume everyone uses bash? </rhethorical_Q>

Thanks mandyapenguin!
Hi Habitua,
I have ever seen as where there is no usernmae, hostname and pwd info (like [johnny@server ~]$) after logged in and also there is no command completion while we are using shell as /bin/sh. So I am guessing about login shell.

Last edited by mandyapenguin; 09-24-2012 at 11:11 PM.
 
Old 09-25-2012, 11:43 AM   #6
tar1827
LQ Newbie
 
Registered: Jun 2007
Location: West Michigan, USA
Distribution: Fedora
Posts: 9

Original Poster
Rep: Reputation: 0
Thumbs up

Wow, thanks for the help! Just looking at your suggestions and looking in the home directories of each lead me to discover that tommy had no .bashrc file at all. For completeness, here are the results of the various commands:

Code:
-bash-4.2$ ls -al
total 20
drwxrwxr-x. 2 tommy users  4096 Sep 25 12:16 .
drwxr-xr-x. 6 root   root   4096 Jul  8 18:27 ..
-rw-------  1 tommy tommy  360 Sep 24 12:00 .bash_history
-rw-r--r--  1 tommy users   176 Sep 24 10:34 .bash_profile
-rw-------  1 tommy tommy   53 Sep 25 12:16 .Xauthority
-bash-4.2$ grep tommy /etc/passwd
tommy:x:1001:1001:Tommy:/home/tommy:/bin/bash
-bash-4.2$
Code:
[johnny@server ~]$ grep johnny /etc/passwd
johnny:x:1000:1000:Johnny:/home/johnny:/bin/bash
[johnny@server ~]$ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions
[johnny@server ~]$
So the simplest answer was the one. I copied the .bashrc file over, reset the ownership, and the problem was resolved!

Code:
Using username "tommy".
tommy@server's password:
Last login: Tue Sep 25 12:27:40 2012 from c-111-2-333-44.some.isp
[tommy@server ~]$
Thank you, again, for your assistance. I know it's a minor thing, but it was irritating me!
 
Old 09-25-2012, 01:11 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by tar1827 View Post
Code:
$ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions
Tommy, I think that is supposed to be the contents of any .bash_profile
See http://www.linuxquestions.org/questi...9/#post2914160 for details.

NOTE: root will need these files (/root/.bash_profile and /root/.bashrc) created also.

Please let us know...

Last edited by Habitual; 09-25-2012 at 01:13 PM.
 
Old 09-25-2012, 10:28 PM   #8
tar1827
LQ Newbie
 
Registered: Jun 2007
Location: West Michigan, USA
Distribution: Fedora
Posts: 9

Original Poster
Rep: Reputation: 0
Well, I guess I need to do a better job of searching...both here and on my own system. I should have noticed that the .bashrc file was missing for tommy. Root had it already, and so did johnny. I'm not sure how it got that way, but I learned some more about bash today. The link you provided would have been a good thread for me to have read before posting.

Thanks again to Habitual and mandyapenguin for your assistance.
Best regards to all...

(BTW, I didn't see an obvious way to mark this as solved; I'm not sure that matters on LQ Forum)
 
  


Reply

Tags
bash, prompt, ssh



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
[SOLVED] Make Bash prompt look like Windows C:\ prompt -- *PROBLEM* arkadios Linux - General 5 07-24-2012 11:29 AM
[SOLVED] Issue logging in via SSH Hobbletoe Solaris / OpenSolaris 1 05-17-2012 08:10 AM
How to get bash prompt right after logging into a server? chekhov_neo Linux - Newbie 9 02-28-2011 01:43 PM
How to change .bashrc prompt for logging in via SSH. Amckin Linux - Laptop and Netbook 1 11-04-2009 12:48 PM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 09:25 AM

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

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