LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-01-2021, 01:28 PM   #1
DD345
LQ Newbie
 
Registered: Jun 2021
Posts: 16

Rep: Reputation: Disabled
Create sftp-only account


I have setup VSFTPD as my ftp server. I would like to create a sftp-only account, I am not sure how this should be done in Slackware.
 
Old 06-01-2021, 04:20 PM   #2
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
VSFTPD is for the ftp protocol, not sftp. If you want to use sftp (and it IS preferable to ftp if you're not sure you want ftp), then you need to set up ssh server.
 
Old 06-01-2021, 05:38 PM   #3
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by DD345 View Post
I have setup VSFTPD as my ftp server. I would like to create a sftp-only account, I am not sure how this should be done in Slackware.
All that is needed for sftp is an ssh account. I'm pretty sure the ssh server is started by default on a new install. It also defaults to any user having ssh/sftp access.

So, most likely, all you need to do is connect to the computer using sftp by providing your user's username and password.
 
Old 06-01-2021, 08:02 PM   #4
DD345
LQ Newbie
 
Registered: Jun 2021
Posts: 16

Original Poster
Rep: Reputation: Disabled
Hi thanks,

I set the VSFTPD as my ftp server. I was able to connect using a local account, now I have an issue where it says protocol is not assigned despite me not making any modifications and also reconfiguring from scratch. I know this is a different issue, but is there anyway to check what the issue is or why this is the case?
 
Old 06-01-2021, 08:07 PM   #5
DD345
LQ Newbie
 
Registered: Jun 2021
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bassmadrigal View Post
All that is needed for sftp is an ssh account. I'm pretty sure the ssh server is started by default on a new install. It also defaults to any user having ssh/sftp access.

So, most likely, all you need to do is connect to the computer using sftp by providing your user's username and password.
I was able to connect using a local account, but I would like this user not to be able to log in via ssh.
 
Old 06-01-2021, 08:12 PM   #6
DD345
LQ Newbie
 
Registered: Jun 2021
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by IsaacKuo View Post
VSFTPD is for the ftp protocol, not sftp. If you want to use sftp (and it IS preferable to ftp if you're not sure you want ftp), then you need to set up ssh server.
I did not know this, thank you. Would something like Dropbear SSH/OpenSSH work?

Last edited by DD345; 06-01-2021 at 08:14 PM.
 
Old 06-01-2021, 08:51 PM   #7
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,351

Rep: Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062
Quote:
Originally Posted by DD345 View Post
I was able to connect using a local account, but I would like this user not to be able to log in via ssh.
You can add the option DenyUsers to your /etc/ssh/sshd_config
Code:
DenyUsers
This keyword can be followed by a list of user name patterns, separated by spaces.
Login is disallowed for user names that match one of the patterns
 
Old 06-01-2021, 09:10 PM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,304
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
Quote:
Originally Posted by DD345 View Post
Would something like Dropbear SSH/OpenSSH work?
Yes, but OpenSSH would give the most functionality. Please remove vsftpd while you are in there.

Then for SFTP-only accounts with OpenSSH, assign a new system group and put the accounts which should be restricted into it. Then use a Match directive in sshd_config to set up the SFTP-only access. One way would be like this:

Code:
Subsystem sftp internal-sftp

Match Group limited
	ForceCommand internal-sftp
        AllowStreamLocalForwarding no
	AllowTCPForwarding no
	X11Forwarding no
There, any accounts in the group 'limited' will only be able to use SFTP and be set to use the built-in SFTP server. See "man sshd_config" for more details on those settings.

Newer versions of OpenSSH can have a simpler configuration:

Code:
Subsystem sftp internal-sftp

Match Group limited
	ForceCommand internal-sftp
        DisableForwarding yes
 
3 members found this post helpful.
Old 06-01-2021, 09:37 PM   #9
Thom1b
Member
 
Registered: Mar 2010
Location: France
Distribution: Slackware
Posts: 484

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Hi, I needed to have a sftp-only account on a different sshd port. I choose to use proftpd, it works very well.
 
Old 06-01-2021, 09:50 PM   #10
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,351

Rep: Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062
Quote:
Originally Posted by Thom1b View Post
Hi, I needed to have a sftp-only account on a different sshd port. I choose to use proftpd, it works very well.
you can also create a user with /sbin/nologin instead of /bin/bash as login shell
and ChrootDirectory in sshd_config
Code:
Match User sftp_only_user
   ChrootDirectory /some_sftp_directory
   ForceCommand internal-sftp

Last edited by marav; 06-01-2021 at 09:53 PM.
 
Old 06-01-2021, 11:45 PM   #11
DD345
LQ Newbie
 
Registered: Jun 2021
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thank you for the help, I am now trying to ssh for playing around/testing purposes. When I attempt to do so it says "port 22: Protocol not available".

What exactly does this mean and how can I resolve this?

Last edited by DD345; 06-01-2021 at 11:48 PM.
 
Old 06-02-2021, 02:18 AM   #12
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,351

Rep: Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062Reputation: 4062
Quote:
Originally Posted by DD345 View Post
Thank you for the help, I am now trying to ssh for playing around/testing purposes. When I attempt to do so it says "port 22: Protocol not available".

What exactly does this mean and how can I resolve this?
you can try with : ssh -v user@host
to debug
 
Old 06-02-2021, 05:51 AM   #13
fskmh
Member
 
Registered: Jun 2002
Location: South Africa
Distribution: Custom slackware64-current
Posts: 307

Rep: Reputation: 92
Quote:
Originally Posted by DD345 View Post
I have setup VSFTPD as my ftp server. I would like to create a sftp-only account, I am not sure how this should be done in Slackware.
It looks like the OP is close to a solution but here's my suggestion anyway. I use rssh (restricted shell) on a lab gateway machine that I deploy Clonezilla images from. I've firewalled out non-local subnets but to prevent users in the lab from ssh-ing as the Clonezilla user I installed rssh and set the login shell to /usr/bin/rssh.

https://slackbuilds.org/repository/14.2/network/rssh/

rssh appears to be unmaintained so I would not open it to the interwebs unless you have fail2ban and/or a robust firewall config.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SFTP using another account with passwordless sftp access jobart08 Linux - Newbie 3 03-23-2016 06:14 AM
Unable to SFTP with a user made for only to perform SFTP raj2arora2009 Linux - Security 1 04-10-2012 07:23 AM
vsftpd with one account upload only and other account download only ahmadnawaz Linux - Server 2 08-10-2010 11:52 PM
how to create sftp user only in red hat 4 not ftp user ..only sftp user princeu28 Linux - Newbie 1 10-14-2008 08:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration