Solved

Linux username can't access own home directory via ftp

Posted on 2014-01-21
6
731 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now