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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
09-24-2012, 12:23 PM
|
#1
|
LQ Newbie
Registered: Jun 2007
Location: West Michigan, USA
Distribution: Fedora
Posts: 9
Rep:
|
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 ~]$
|
|
|
09-24-2012, 12:40 PM
|
#2
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
post tommy's .bashrc?
|
|
|
09-24-2012, 12:51 PM
|
#3
|
Member
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106
Rep:
|
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 09:41 PM.
|
|
2 members found this post helpful.
|
09-24-2012, 07:43 PM
|
#4
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
Quote:
Originally Posted by mandyapenguin
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.
|
09-24-2012, 09:52 PM
|
#5
|
Member
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106
Rep:
|
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-25-2012 at 12:11 AM.
|
|
|
09-25-2012, 12:43 PM
|
#6
|
LQ Newbie
Registered: Jun 2007
Location: West Michigan, USA
Distribution: Fedora
Posts: 9
Original Poster
Rep:
|
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!
|
|
|
09-25-2012, 02:11 PM
|
#7
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
Quote:
Originally Posted by tar1827
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 02:13 PM.
|
|
|
09-25-2012, 11:28 PM
|
#8
|
LQ Newbie
Registered: Jun 2007
Location: West Michigan, USA
Distribution: Fedora
Posts: 9
Original Poster
Rep:
|
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)
|
|
|
All times are GMT -5. The time now is 05:18 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|