LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-31-2009, 01:58 PM   #1
sfuser
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
ssh not sourcing the user profile


using ssh to logon to a remote unix box from my java code.

String[] cmd = {"cmd","/C","ssh -W pass testusr@server","/home/testusr/test.ksh"};

This code doesnt seem to source the testusr profile.

in the test.ksh i am writing the environment varibales to a file to see if the correct PATH variables have been set but i only see the below

this is what i have in the test.ksh

echo $PATH > test.out

This is what is written to the test.out.

/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/usr/ja
va14/bin:/usr/local/bin:/usr/local/sec:/opt/quest/bin

which is not the testusr PATH. Looks like when i logon using the ssh it is not sourcing the testusr profile

anything special i need to do to source the profile?

Any help will be truly appreciated. thanks.
 
Old 10-31-2009, 03:31 PM   #2
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
Insert 'whoami' into your script. See which user is executing ssh.
 
Old 11-01-2009, 10:00 AM   #3
sfuser
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
whoami shows testusr which is correct, the problem is the .profile for testusr is not being invoked and hence the environment variables are not being set and the script fails.ANything else you would like me to try? Thanks for the posting. Looking forward to hearing from you. thanks.
 
Old 11-01-2009, 10:07 AM   #4
dxqcanada
Member
 
Registered: Sep 2006
Location: Canada
Distribution: Gentoo
Posts: 702

Rep: Reputation: 43
From the ssh man page:

ssh will normally set the following environment variables:

PATH Set to the default PATH, as specified when compiling ssh.

Additionally, ssh reads ~/.ssh/environment, and adds lines of the format “VARNAME=value” to the environment if the file exists and users are allowed to change their environment. For more information, see the PermitUserEnvironment option in sshd_config(5).
 
  


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
Can I copy a user profile to another user? michalng Linux - Newbie 12 04-19-2015 06:02 AM
Konsole ssh command dies when issued in profile racc11 Linux - Newbie 1 03-20-2009 12:40 PM
system profile vs user profile bonito SUSE / openSUSE 3 06-28-2006 02:02 PM
Load kde profile from /mnt/removable/user instead of /home/user preacher.ca Linux - General 3 12-02-2005 04:00 PM
Root SSH Bash Profile djhorza Linux - Software 1 12-22-2003 06:28 AM


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