Solved

Linux username can't access own home directory via ftp

Posted on 2014-01-21
6
765 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
[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
  • 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

Technology Partners: 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

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

719 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