Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Jul 2006
    Location
    IndiaMDM
    Posts
    365

    Question How to create an SFTP Server?

    How to create an SFTP Server using Linux CentOS?
    HostechSupport
    24x7 Remote Services
    Linux/Windows Server Administration Server Management
    Get in touch: support@hostechsuppport.com

  2. #2
    Registered User mikecowell's Avatar
    Join Date
    Apr 2019
    Location
    London
    Posts
    262
    1.Create a dedicated sFTP group and a dedicated sFTP user. groupadd sftpusers useradd -g sftpusers -s /sbin/nologin user1 passwd user1.
    2. Modify the configuration of the sshd service.
    3.Create a dedicated directory for the sFTP-only user.
    4.Create more sFTP-only users.

  3. #3
    Registered User
    Join Date
    May 2019
    Location
    Thane and United States
    Posts
    28
    What you'll need

    As I mentioned, CentOS 7 already has everything you need, out of the box. What you must have, however, is access to an account with admin rights. Once you've procured that access, it's time to make this work.

    SFTP Directory
    The first thing we must do is create a directory that will house our FTP data. Open up a terminal window, su to the root user (type su and then, when prompted, type the root user password), and then issue the following two commands:

    mkdir -p /data/sftp
    chmod 701 /data
    Create the SFTP group and user
    Now we're going to create a special group for SFTP users. This is done with the following command:

    groupadd sftp_users
    Now we're going to create a special user that doesn't have regular login privileges, but does belong to our newly created sftp_users group. What you call that user is up to you. The command for this is:

    useradd -g sftp_users -d /upload -s /sbin/nologin USERNAME
    Where USERNAME is the name of the user.

    Next, give the new user a password. This password will be the password the new users use to log in with the sftp command. To set up the password, issue the command:

    passwd USERNAME
    Where USERNAME is the name of the user created above.

    Create the new user SFTP directory
    Now we're going to create an upload directory, specific to the new user, and then give the directory the proper permissions. This is handled with the following commands:

    mkdir -p /data/USERNAME/upload
    chown -R root:sftpusers /data/USERNAME
    chown -R USERNAME:sftpusers /data/USERNAME/upload
    Where USERNAME is the name of the new user you created above.

    Configure sshd
    Open up the SSH daemon configuration file with the command:

    nano /etc/ssh/sshd_config
    At the bottom of that file, add the following:

    Match Group sftpusers
    ChrootDirectory /data/%u
    ForceCommand internal-sftp
    Save and close that file. Restart SSH with the command:

    systemctl restart sshd
    Logging in
    You're all set to log in. From another machine on your network that has SSH installed, open up a terminal window and issue the command:

    sftp USERNAME@SERVER_IP
    Where USERNAME is the name of our new user and SERVER_IP is the IP address of our SFTP server. You will be prompted for USERNAME's password. Once you successfully authenticate, you will be greeted with the sftp prompt. Type pwd to check the working path and you should see /upload (Figure A).

    Figure A

    Name:  5G.jpg
Views: 236
Size:  47.7 KB

  4. #4
    Registered User
    Join Date
    Dec 2016
    Location
    Mumbai
    Posts
    165
    Thanks for sharing your knowledge.

  5. #5
    Registered User
    Join Date
    Jul 2019
    Location
    USA
    Posts
    66
    I had a need last year to implement a zero-cost SFTP (ftp over ssh) solution for an appliance backup to a windows server that only supported FTP over SSH.

    I ended up using OpenSSH for Windows available here: http://sshwindows.sourceforge.net/

    It's basically a simpler installer package consisting of the cygwin and openssh binaries but it i still a pita to configure.

    The concern for this package would be the age of the OpenSSH code but it is functional and if you are only using on your internal network should be less of a concern.



    There is also another windows packaged OpenSSH implementaiton that is free called copssh but I haven't played with it as of yet. But it's OpenSSH binaries are kept more up to date, currently the 5.9 codebase.. http://www.itefix.no/i2/copssh

    I'm purely using the SCP functions so I can't speak for any real administration or shell capabilities of either of these.

    --
    Smith
    Admin | Apps4Rent
    Office 365 Migration | Office 365

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.