Solved

Permissions+default directory in openssh on ubuntu

Posted on 2013-01-27
7
594 Views
Last Modified: 2013-02-01
I have a pretty basic ubuntu system running in a vm to do open-ssh.  By default each user that gets in via sftp goes to /home/username.  I need to change a user to go to a different directory when logging in.  Note that this user has no password, just a private key (so its authenticating with username+private key).  I need the user bob to default to the /home/homer directory.  I change this by nano /etc/passwd and changing the default but then when user chuck tries to login it doesnt work - says server refused our connection, change it back to /home/bob and it works fine.  Bob does have all access to /home/homeward...he can write files to that directory, change to that directory, and delete files from the directory so not sure why he cant go to that directory by default.
Using winscp to connect (windows machine) and you can specify the local and remote directories - doing this WILL work and allow him to "default" into the /home/homer directory, but I think winscp just logs in then changes directories for him right away (instead of the actual server putting him in that folder which is what I need).
Thoughts?
I tried doing it via a group too - still no luck
0
Comment
Question by:rhwimmers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 78

Expert Comment

by:arnold
ID: 38824461
Sftp is part of ssh and is directing the user to their home directory by default.

You could use usermod to alter the home directory thus altering where the user will end up upon logon.
I think winscp includes the option to specify the path /home/homeward rather than relying on the default.
0
 
LVL 1

Author Comment

by:rhwimmers
ID: 38824553
What command would that be?
0
 
LVL 78

Expert Comment

by:arnold
ID: 38824573
Not clear which point from my comment you want addressed in this response.
usermod -d /home/homeward homer
this will also affect the users ssh login which will now get them started at /home/homeward ( you could use .login, .profile, .bash_profile .bashrc to cd to a different directory) but cd ~homer wil always go to where the home directory is pointing within passwd.

I think winscp has the option prior to the connection for the specification of the remote directory which you could use /home/homeward
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 1

Author Comment

by:rhwimmers
ID: 38825017
Still get the same thing "server refused our key" - that is the winscp error I get anytime I try to change the user homer to get into /home/homeward
0
 
LVL 1

Author Comment

by:rhwimmers
ID: 38825040
Seems like no matter what I do with usermod -d or editing the /etc/passwd to change the path of the user, I cannot login with the user unless its set to his default /home/homer.  As mentioned earlier - login with username and a key file - the key file has nothing to do with the location right, its just for authentication purposes - just strange that as soon as I change the directory it fails as if its an auth issue.  And again, once logged in I CAN access these directories I am trying to have the user land in by default

server refused our key
authentication failed is the error I get
0
 
LVL 1

Accepted Solution

by:
rhwimmers earned 0 total points
ID: 38825160
Ran across this article which solved my issue.  The default is store the key in an encrypted (hidden) folder (.ssh) so moving that elsewhere did the trick.

http://adamwright.wordpress.com/2011/05/16/ssh-error-server-refused-our-key-and-how-to-fix-it/
0
 
LVL 1

Author Closing Comment

by:rhwimmers
ID: 38843112
Resolution in link
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
open source backup solution 1 45
awk variable in printf 1 43
CentOS 7 Linux for HP DL380 G4 32Bits 7 79
IP 10.0.1.2 / 255.0.0.0 61 79
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question