Solved

Linux username can't access own home directory via ftp

Posted on 2014-01-21
6
726 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 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
@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 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
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!

 

Author Comment

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

Expert Comment

by:Sandy
Comment Utility
#setseool -P ftp_home_dir on

This will resolve your issue
0
 

Author Closing Comment

by:Victor Kimura
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

772 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

9 Experts available now in Live!

Get 1:1 Help Now