LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-07-2012, 02:32 PM   #1
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Rep: Reputation: 15
what profile file is run when a shell is started via ssh


When I log into a machine via ssh what file is executed?

For bash is is .bash_profile or .bashrc?

Thanks.
 
Old 03-07-2012, 02:57 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi frznchckn,

Quote:
For bash is is .bash_profile or .bashrc?
What you mean by that. When you login via ssh both the files are used. .bashrc located in your home directory takes global definition like umask value (depend on the UID of the user), prompt etc. from /etc/bashrc.

.bash_profile is use to set any user specific environment / variable / path etc.
 
1 members found this post helpful.
Old 03-07-2012, 03:10 PM   #3
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
Thanks terminator. I didn't know the specifics, but you confirmed what I thought. The problem is actually this then:

I have set up ssh on my Windows 7 machine via cygwin and openssh. When I log into localhost, I get the following:

Could not chdir to home directory : No such file or directory
mkdir: cannot create directory `': No such file or directory
could not be created.
Setting HOME to /tmp.

A few google searches seemed to turn up nothing concrete, so I thought I would solve this by added the following to my .bashrc

export HOME=/home/username

cd $HOME

echo "finished"

And as I type this I realize that didn't help because the shell couldn't find my home dir to begin with. Any other ideas per chance?

Thanks.
 
Old 03-07-2012, 03:15 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Your home directory is specified in /etc/passwd and it looks like as follows:

Code:
tester:x:511:511::/home/tester:/bin/bash
Where tester is the username 511 is his uid and gid /home/tester is his home directory and /bin/bash is the default shell used by this user. x mentioned in this line denotes that the password for this user is linked to /etc/shadow (in encrypted form for added security)

Make sure that the user with which you are trying to login has got home directory under /home and has got rwx permission on his home directory.
 
1 members found this post helpful.
Old 03-07-2012, 03:29 PM   #5
frznchckn
Member
 
Registered: Jun 2006
Location: TX
Distribution: Debian
Posts: 102

Original Poster
Rep: Reputation: 15
Smile

Oh geez, I knew home was specified in passwd but would've never connected the two here! Thanks, that worked!
 
  


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
[SOLVED] Need user account which can connect by ssh but not login locally nor run shell taylorkh Linux - General 11 07-05-2011 07:49 AM
How to use ssh and run command in the remote machine using shell script salmanmanekia Linux - Newbie 8 04-28-2011 07:41 AM
Started Firefox as root, now lost my profile PClOStinspace Linux - Newbie 4 04-26-2009 03:26 PM
can't run source /etc/profile from script file? any help would be great! icecoolcorey Programming 12 06-17-2008 07:20 PM
how to run a compile file in shell? v3sS0n Linux - Newbie 2 09-25-2004 05:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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