Solved

Linux username can't access own home directory via ftp

Posted on 2014-01-21
6
751 Views
Last Modified: 2014-01-26
Hi,

I'm using PhpStorm as  my IDE. I set up the Auth type as OpenSSH for logging via SFTP.

I can access the the root but I can't access the username's home directory at:
/home/myultrat

the username is myultrat.

See the screenshot

But when logging in via putty to get some information on the username myultrat:
# echo ~myultrat
/home/myultrat

[/home/myultrat]# ls -al
total 108
drwx--x--x 16 myultrat myultrat 4096 Jan 13 05:08 ./
drwx--x--x 11 root     root     4096 Jan 16 02:25 ../
drwx------  2 myultrat myultrat 4096 Aug 21  2012 .HttpRequest/
drwx------  3 myultrat myultrat 4096 Aug 21  2012 .MirrorSearch/
-rw-------  1 myultrat myultrat  380 Dec  2 03:58 .bash_history
-rw-r--r--  1 myultrat myultrat   33 Aug  9  2012 .bash_logout
-rw-r--r--  1 myultrat myultrat  176 Aug  9  2012 .bash_profile
-rw-r--r--  1 myultrat myultrat  124 Aug  9  2012 .bashrc
-rw-------  1 myultrat myultrat   17 Aug  9  2012 .contactemail
drwx------  5 myultrat myultrat 4096 Dec 13 14:09 .cpanel/
-rw-r--r--  1 myultrat myultrat   16 Jan 21 01:50 .dns
-rw-------  1 myultrat myultrat   14 Jan 12 02:37 .ftpquota
-rw-r--r--  1 myultrat myultrat  964 Oct 11  2012 .htaccess
drwxr-x---  2 myultrat nobody   4096 Aug  9  2012 .htpasswds/
-rw-------  1 myultrat myultrat   13 Dec 13 14:09 .lastlogin
-rw-------  1 myultrat myultrat    3 Oct 25  2012 .mysql_history
-rw-------  1 myultrat myultrat 1024 Aug 10  2012 .rnd
drwx------  2 myultrat myultrat 4096 Aug 10  2012 .ssh/
lrwxrwxrwx  1 myultrat myultrat   34 Jul 11  2013 access-logs -> /usr/local/apac    he/domlogs/myultrat/
drwxr-xr-x  3 myultrat myultrat 4096 Aug 14  2012 classes/
drwxr-x---  3 myultrat mail     4096 Mar  4  2013 etc/
drwx------  2 myultrat myultrat 4096 Jan 13 05:08 logs/
drwxr-x--x  9 myultrat myultrat 4096 Mar  4  2013 mail/
drwxr-xr-x  2 myultrat myultrat 4096 Aug 10  2012 perl5/
drwxr-xr-x  3 myultrat myultrat 4096 Aug 11  2012 public_ftp/
drwxr-x--- 12 myultrat nobody   4096 Jan 16 02:39 public_html/
drwx------  7 myultrat myultrat 4096 Jan 13 03:34 ssl/
drwxr-xr-x  8 myultrat myultrat 4096 Mar  4  2013 tmp/
lrwxrwxrwx  1 myultrat myultrat   11 Jul 11  2013 www -> public_html/
root@ip-184-168-116-73 [/home/myultrat]# echo ~myultrat

Open in new window


I noticed that the directory:
 /home/myultrat/public_html belongs to:
myultrat:nobody

and the directory:
/home/myultrat belongs to:
myultrat:myultrat

How come I can't access /home/myultrat the sub-directories via SFTP? What permissions do I need to change? Do I need to add the username to a group?

Thanks<><
Screenshot-2014-01-21-01.07.26.png
0
Comment
Question by:Victor Kimura
  • 3
  • 2
6 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
ID: 39796331
Why are you logging in as 'root' instead of 'myultrat'?  Logging in as 'myultrat' should take straight to the /home/myultrat directory.
0
 

Assisted Solution

by:Victor Kimura
Victor Kimura earned 0 total points
ID: 39796539
@Dave,

Ok, I think I see.

When I create a FTP user via cPanel then it doesn't connect via SFTP but it does with FTP.

I created an openSSH key pair for SFTP login purposes and I got the username myultrat to work. I had to configure my Mappings in the settings.

If I wanted create another SFTP login for permission access to a certain directory and sub-directories only then how would I do this? I think I recall how to create the keys for openSSH but then I don't know how that username is given access to certain directories then via SFTP.

Thank you
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39797597
SFTP and SSH are regular logins like you would use to get to your own directory in '/home'.  It's the same as a telnet or plain FTP login to your own directories.  At least that's the way it has always worked for me.  I don't remember having to set anything up to use it (except for the SSH server).
0
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!

 

Author Comment

by:Victor Kimura
ID: 39798676
Ok, I'll test it out. Thanks, Dave! =)
0
 
LVL 13

Expert Comment

by:Sandy
ID: 39799411
#setseool -P ftp_home_dir on

This will resolve your issue
0
 

Author Closing Comment

by:Victor Kimura
ID: 39809848
I created an openSSH key pair for SFTP login purposes and I got the username myultrat to work. I had to configure my Mappings in the settings.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

749 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