Fedora Linux Support Community & Resources Center
  #1  
Old 21st July 2009, 08:59 AM
codingfreak Offline
Registered User
 
Join Date: May 2009
Location: /home/earth
Posts: 85
Unhappy Problem when using SSH

Hi

I have a strange problem when I do SSH to a FEDORA9 based Linux Server.

Code:
$ ls -al /home/
total 68
drwxr-xr-x 16 root    root         4096 2009-07-21 09:30 .
drwxr-xr-x 22 root    root         4096 2009-07-21 08:36 ..
lrwxrwxrwx  1 root    root           25 2009-06-19 10:52 adah -> /media/disk-1/home/adah
lrwxrwxrwx  1 root    root           24 2009-06-19 10:45 ajsin -> /media/disk-1/home/ajsin
lrwxrwxrwx  1 root    root           25 2009-06-19 10:53 akhtam -> /media/disk-1/home/akhtam
As you see from the above information that symbolic links were created for accounts adah, akhtam and so on.

When I login using "adah" username in TELNET I am automatically directed to my home directory at location "/media/disk-1/home/adah".

But when I use SSH to login using the same username I get the following message

Code:
Could not chdir to home directory /home/adahaj: Permission denied
How can I rectify above problem ???
__________________
codingfreak
http://codingfreak.blogspot.com

:confused:
Reply With Quote
  #2  
Old 21st July 2009, 11:36 AM
John5342 Offline
Registered User
 
Join Date: Jan 2008
Location: /dev/darkness
Posts: 103
SSH is very strict about the permissions and requirements of certain directories and files for security reasons. This includes no symlinks in the path.

What you should really do instead is instead of using symlinks mount the appropriate drive in the correct place. so mount /media/disk-1/home/adah as /home/adah and /media/disk-1/home/ajsin as /home/ajsin etc

If you dont have any other directories under /home/ then you would be even better mounting /media/disk-1/home as /home

Also the directories will probably have the wrong labels at the moment so once you have the mounts sorted you will probably want to as root 'touch /.autorelabel' and then reboot.
__________________
F15 x86_64 - AMD FX60 - 4GB DDR - 4x 1TB RAID0 - 2x 9800GX2
F15 x86_64 - AMD64 X2 3800+ - 1GB DDR - 2x 750GB - 7800GT
OOKernel OS - AG2 GCU - 32TB ARAM - 1TB PRAM - AG1 TCU
Reply With Quote
  #3  
Old 21st July 2009, 11:42 AM
John5342 Offline
Registered User
 
Join Date: Jan 2008
Location: /dev/darkness
Posts: 103
Also another issue is that those directories have the wrong ownership. Each of the directories you listed should be owned by the appropriate user.

Code:
# chown adah:adah /home/adah
# chown ajsin:ajsin /home/ajsin
# chwon akhtam:ahhtam /home/akhtam
__________________
F15 x86_64 - AMD FX60 - 4GB DDR - 4x 1TB RAID0 - 2x 9800GX2
F15 x86_64 - AMD64 X2 3800+ - 1GB DDR - 2x 750GB - 7800GT
OOKernel OS - AG2 GCU - 32TB ARAM - 1TB PRAM - AG1 TCU
Reply With Quote
  #4  
Old 21st July 2009, 12:28 PM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 9,041
I don't know who started this rumor, but this has nothing to do with ssh. The only thing ssh cares about wrt to your home directory is that it exists. If the permissions are too lax it will ignore your authentication keys too, but it doesn't prevent login.


Ssh exec's a shell and the shell lacks permission to cd(chdir syscall) to that directory.

It's a clear permissions error. You can't chdir to a directory unless you (the user account) have 'x' search permission for that directory. You don't.

The home directory of each account should have directory owner and group-owner of that account and 700 permissions,, but this is NOT necessary for ssh to work correctly.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #5  
Old 21st July 2009, 12:36 PM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 9,041
Quote:
Originally Posted by John5342 View Post
Also another issue is that those directories have the wrong ownership. Each of the directories you listed should be owned by the appropriate user.

Code:
# chown adah:adah /home/adah
# chown ajsin:ajsin /home/ajsin
# chwon akhtam:ahhtam /home/akhtam


John is leading you down another bad path here. The ownership and permission on these **symbolic links** DO NOT reflect the actual directory permissions.

You *may* need to do this:
chown adah:adah /media/disk-1/home/adah
chmod 700 /media/disk-1/home/adah


and so on, but we cannot say from your information. All we know is that user adah does not have 'x' (search) permission to /media/disk-1/home/adah.



Perhaps you should post the output of ls -l /media/disk-1 for comment.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 21st July 2009 at 12:38 PM.
Reply With Quote
  #6  
Old 21st July 2009, 12:40 PM
codingfreak Offline
Registered User
 
Join Date: May 2009
Location: /home/earth
Posts: 85
Quote:
Originally Posted by John5342 View Post
Also another issue is that those directories have the wrong ownership. Each of the directories you listed should be owned by the appropriate user.

Code:
# chown adah:adah /home/adah
# chown ajsin:ajsin /home/ajsin
# chwon akhtam:ahhtam /home/akhtam
I have used "chown" command and changed for the user "adah"
Code:
$ ls -al /home/
total 68
drwxr-xr-x 16 root    root         4096 2009-07-21 09:30 .
drwxr-xr-x 22 root    root         4096 2009-07-21 08:36 ..
lrwxrwxrwx  1 adah  users          25 2009-06-19 10:52 adah -> /media/disk-1/home/adah
But still I get the "permission denied error" when I use SSH to login for the user "adah".

NOTE: I am getting "permission denied error" when I logged into server using SSH. Once logged in through SSH I am still able to access my home directory.

output of "ls -al /media/disk-1/home"

Code:
$ ls -al /media/disk-1/home
total 80
drwxr-xr-x 20 root     root  4096 2009-07-21 09:29 .
drwxr-xr-x  4 root     root  4096 2009-06-19 08:46 ..
drwx------ 32 adah   users 4096 2009-07-21 17:02 adah
drwx------  8 ajsin    users 4096 2009-07-15 16:08 ajsin
drwx------  4 akhtam   users 4096 2009-06-18 17:54 akhtam
__________________
codingfreak
http://codingfreak.blogspot.com

:confused:

Last edited by codingfreak; 21st July 2009 at 12:46 PM.
Reply With Quote
  #7  
Old 22nd July 2009, 10:29 AM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 9,041
First, please give the complete and accurate error message. Is the error still referencing chdir ? No one can diagnose with only part of the error message.

Here is an example on my system. My home directory /home/stevea is a soft link to /home/xxx
Code:
[mdi@lycoperdon home]$ ls -ld /home/stevea /home/xxx
lrwxrwxrwx  1 root   root      3 2009-07-22 05:15 /home/stevea -> xxx
drwx------ 58 stevea stevea 4096 2009-07-22 05:14 /home/xxx
[mdi@lycoperdon home]$ ssh stevea@localhost
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
stevea@localhost's password: 
Last login: Wed Jul 22 05:15:23 2009 from localhost.localdomain
[stevea@lycoperdon ~]$ pwd
/home/stevea
So ssh is not the problem.

If I mess up the link ownership, as you have done then it still works.
Code:
[root@lycoperdon home]# ls -ld  /home/stevea /home/xxx
lrwxrwxrwx  1 stevea stevea    3 2009-07-22 05:28 /home/stevea -> xxx
drwx------ 58 stevea stevea 4096 2009-07-22 05:14 /home/xxx
[root@lycoperdon home]# ssh stevea@localhost
stevea@localhost's password: 
Last login: Wed Jul 22 05:19:44 2009 from localhost.localdomain

Cut and paste your exact error messages.


My *guess* is this. The files under /media/disk-1/adah are not owned by adah. If you did
ls -l /media/disk-1/adah
you should see this.

If this is the case then you may want to do
chown -R adah:user /media/disk-1/adah
to recursively change the ownership of all files in this directory.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 22nd July 2009 at 10:40 AM.
Reply With Quote
  #8  
Old 22nd July 2009, 10:43 AM
codingfreak Offline
Registered User
 
Join Date: May 2009
Location: /home/earth
Posts: 85
Quote:
Originally Posted by stevea View Post
First, please give the complete and accurate error message. Is the error still referencing chdir ? No one can diagnose with only part of the error message.

Here is an example on my system. My home directory /home/stevea is a soft link to /home/xxx
Code:
[mdi@lycoperdon home]$ ls -ld /home/stevea /home/xxx
lrwxrwxrwx  1 root   root      3 2009-07-22 05:15 /home/stevea -> xxx
drwx------ 58 stevea stevea 4096 2009-07-22 05:14 /home/xxx
[mdi@lycoperdon home]$ ssh stevea@localhost
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
stevea@localhost's password: 
Last login: Wed Jul 22 05:15:23 2009 from localhost.localdomain
[stevea@lycoperdon ~]$ pwd
/home/stevea
Code:
$ ssh adah@localhost
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
adah@localhost's password: 
Last login: Wed Jul 22 15:05:38 2009 from 

WELCOME TO LINUX SERVER ....

Could not chdir to home directory /home/adah: Permission denied
[adah@localhost /]$ pwd
/
[adah@localhost /]$
__________________
codingfreak
http://codingfreak.blogspot.com

:confused:
Reply With Quote
Reply

Tags
problem, ssh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump


Current GMT-time: 15:01 (Thursday, 25-12-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
...Chatellerault, France - Kappa Kappa Gamma - True Fitness, Taipan Instagram Photos - Stazione di Formia Instagram Photos