Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 2nd March 2009, 23:06
webwizzy webwizzy is offline
Junior Member
 
Join Date: Feb 2009
Location: India
Posts: 13
Thanks: 1
Thanked 1 Time in 1 Post
Default How to setup SFTP accounts via SSH?

Hello,

I am just finishing up building my first server. I am able to login to SFTP via my main SSH root account.

Now I want to create a SFTP user that will have full permissions for public_html as I will be using that account exclusively for uploading files and SFTP access, and not my root account. That user should not have SSH access or any other access.

Please tell me if its a good practise, and what commands I need to do it? I am not using any control panels, so only SSH.

man useradd is too complex for me.

Thank you
__________________
Tech and Webmasters Forum
Reply With Quote
Sponsored Links
  #2  
Old 3rd March 2009, 19:28
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

You can add this at the end of /etc/ssh/sshd_config:

Code:
Match User someuser
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand /usr/lib/openssh/sftp-server
Restart SSH afterwards. someuser should then have SFTP access.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 3rd March 2009, 23:26
webwizzy webwizzy is offline
Junior Member
 
Join Date: Feb 2009
Location: India
Posts: 13
Thanks: 1
Thanked 1 Time in 1 Post
Default

After adding the above code, when I restarted sshd, it stopped and did not started again due to some error.

1. anyways, I have added a user through useradd, and he has sftp access by default. I also made him to be the only user to su to root, and disallowed root to login. Is this a good practise??

NOW, I am facing some permission problems. I am using nginx webserver.

- I have my folder structure like this: /home/username/public_html
- Owner of "home" and "username" is root. Fine!
- Owner of public_html is "nginx". Okay!

Now, I am unable to upload files as user "username" in public_html folder (which belongs to nginx). However, if I change the owner of public_html to "username", it works fine.

2. So, my question is how do I make my "username" to be able to add/delete files in folders of other users, except root ofcourse.

Thank you
__________________
Tech and Webmasters Forum

Last edited by webwizzy; 3rd March 2009 at 23:29.
Reply With Quote
  #4  
Old 4th March 2009, 13:58
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
 
Default

You can add "username" to the group of the folder (make sure the group has write permissions on that folder).
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Tags
sftp, useradd

Thread Tools
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I setup a client to have access to create FTP accounts without giving root? cristobalmiguelo General 1 7th January 2008 08:28
Perfect Setup Ubuntu 7, SSH Question chez17 Installation/Configuration 8 28th July 2007 10:18
Courier and Squirrelmail setup for two accounts robcliff HOWTO-Related Questions 1 17th July 2007 18:06
Postfix,Virtual Users,FC5 howto: "System" accounts need manual setup? TWadmin HOWTO-Related Questions 4 30th December 2006 21:07
Ubuntu setup using SSH LuisC-SM HOWTO-Related Questions 9 16th April 2006 16:11


All times are GMT +2. The time now is 09:07.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.