LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-15-2006, 09:34 PM   #1
pridefc
Member
 
Registered: Nov 2005
Distribution: redhat, debian, ubuntu
Posts: 47

Rep: Reputation: 15
ssh to different directory other than home


Is there a way to say when a user uses ssh to remotely login, have the user land in a different directory other than his home directory? I don't necessarily want to chroot them. The user should be able to go into other directories where they have access to.
usermod -d /etc/httpd/html/web username works but the shell changes and some commands can't be run after that.

Thanks.
 
Old 11-15-2006, 11:30 PM   #2
mattrogers
LQ Newbie
 
Registered: Jan 2003
Distribution: Archlinux
Posts: 16

Rep: Reputation: 0
I'm not 100% sure, but I don't think there is. logging in with SSH is not much different than logging in from the console while sitting in front of the keyboard and screen.
 
Old 11-16-2006, 04:58 AM   #3
TheOracle
Member
 
Registered: Nov 2004
Posts: 87

Rep: Reputation: 15
ssh

Hi
What about putting the cd command in the .bash_profile of the machine being logged into?

Hth
Graeme
 
Old 11-16-2006, 06:12 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
If you are an admin with many users for whom you want to do this, you might put something at the end of the /etc/profile, else put it in the user's ~/.bash_profile. Umm, something like:
Code:
if [ "$SSH_CONNECTION" != "" ]; then
    # this is an ssh login, change to the non-home area for this user
    cd /ssh_home/$USER
fi
 
Old 11-16-2006, 09:07 PM   #5
pridefc
Member
 
Registered: Nov 2005
Distribution: redhat, debian, ubuntu
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks! That totally worked.
Is there a way to do the same when connecting using SSH secure file transfer client?
When using SSH secure file transfer client, the user still lands in home rather than the specifed directory.

Thanks!
 
Old 11-17-2006, 06:12 AM   #6
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
Do you mean that:
Code:
scp remoteuser@remotehost:filename .
should copy /ssh_home/filename? Hmm, that's more tricky. Don't know.
 
  


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
Apache Root/Home Directory and setting up FTP for home directories? Mankind75 Linux - Newbie 6 07-23-2006 02:37 PM
want to ssh/ftp to home machine (Slack) from office through home router fincher69 Linux - Networking 2 09-21-2005 10:55 PM
ssh public key authentication to different remote home directory shawn_t Linux - Networking 2 03-20-2005 03:39 PM
SSH lock users to the Home Directory jasonweb Linux - Security 2 04-11-2003 06:20 PM
Non-root users can log in to SSH but not read Home Directory? Bizanshee Linux - Software 1 09-18-2002 07:01 PM


All times are GMT -5. The time now is 11:56 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration