Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-24-2017, 10:49 AM
|
#1
|
Member
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131
Rep:
|
Enabling/disabling VSFTPD via SSH
I have an FTP server set up on my Ubuntu box using vsftpd.
I only need to access it infrequently, therefore for security reasons I was wondering if there was a simple way to enable/disable it via SSH.
I did try SSHing in and using
However it was still accepting clients fine.
Many thanks for any help.
Tim
Last edited by Entropy1024; 07-24-2017 at 11:12 AM.
|
|
|
07-24-2017, 11:30 AM
|
#2
|
Member
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229
Rep:
|
Quote:
Originally Posted by Entropy1024
I have an FTP server set up on my Ubuntu box using vsftpd.
I only need to access it infrequently, therefore for security reasons I was wondering if there was a simple way to enable/disable it via SSH.
I did try SSHing in and using
However it was still accepting clients fine.
Many thanks for any help.
Tim
|
If you are using ubuntu 15.04 or older:
1. To stop till next reboot
2. To start till next stop/reboot
3. To check status
4. To restart
Code:
sudo restart vsftpd
5. To disable service activation on startup
Code:
echo manual | sudo tee /etc/init/vsftpd.override
6. To enable it again
Code:
sudo rm /etc/init/vsftpd.override
As a side note, not sure if vsftp service is called vsftp, or vsftpd. But it is easy to find out.
|
|
|
07-24-2017, 11:34 AM
|
#3
|
Member
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229
Rep:
|
If you are using ubuntu 15.10 or newer, you are dealing with systemd.
To start
Code:
sudo systemctl start vsftpd.service
To stop
Code:
sudo systemctl stop vsftpd.service
To restart
Code:
sudo systemctl restart vsftpd.service
To enable
Code:
sudo systemctl enable vsftpd.service
To disable
Code:
sudo systemctl disable vsftpd.service
To check status
Code:
sudo systemctl status vsftpd.service
|
|
|
07-24-2017, 11:34 AM
|
#4
|
Member
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131
Original Poster
Rep:
|
Sorry my version info was out of date, I'm on 16.04.
I did try
and
with the following error:
Code:
stop: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
|
|
|
07-24-2017, 11:45 AM
|
#5
|
Member
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131
Original Poster
Rep:
|
using your
Code:
sudo systemctl stop vsftpd.service
then
Code:
sudo systemctl status vsftpd.service
I get back
Code:
Jul 24 17:35:31 p5e systemd[1]: Stopped vsftpd FTP server.
However it's still letting clients connect!?
|
|
|
07-24-2017, 11:59 AM
|
#6
|
Moderator
Registered: Aug 2002
Posts: 26,128
|
What client application are you using to connect to the server?
|
|
|
07-24-2017, 12:01 PM
|
#7
|
Member
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131
Original Poster
Rep:
|
Quote:
Originally Posted by michaelk
What client application are you using to connect to the server?
|
I've just been using AndFTP on Android.
|
|
|
07-24-2017, 12:05 PM
|
#8
|
Member
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229
Rep:
|
That client can use sftp, are you sure that you are not using that instead of ftp?
|
|
|
07-24-2017, 12:07 PM
|
#9
|
Member
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131
Original Poster
Rep:
|
Quote:
Originally Posted by dejank
That client can use sftp, are you sure that you are not using that instead of ftp?
|
Yes i'm using SFTP to connect
|
|
|
07-24-2017, 12:09 PM
|
#10
|
Moderator
Registered: Aug 2002
Posts: 26,128
|
sftp is not the same as ftp.
Look at the output of the nmap command to confirm that the ftp port is inactive.
nmap IP_address -p 21
|
|
|
07-24-2017, 12:11 PM
|
#11
|
Member
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229
Rep:
|
Quote:
Originally Posted by Entropy1024
Yes i'm using SFTP to connect
|
Well, sftp uses ssh for connection, not ftp. So no wonder that you can connect Disable ssh and you will not be able to.
|
|
|
07-24-2017, 12:16 PM
|
#12
|
Member
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131
Original Poster
Rep:
|
Quote:
Originally Posted by dejank
Well, sftp uses ssh for connection, not ftp. So no wonder that you can connect Disable ssh and you will not be able to.
|
Ah OK. But then I will not be able to turn it on again over SSH. OK I need another way of doing this then
|
|
|
07-24-2017, 12:22 PM
|
#13
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
ufw possibly help?
short version on the ftp "server"
Code:
sudo ufw deny 21
sudo ufw allow from <friendly_IP> to any port 21
|
|
|
07-24-2017, 12:24 PM
|
#14
|
Moderator
Registered: Aug 2002
Posts: 26,128
|
vsftpd stands for Very Secure FTP Daemon. As stated it is not a sftp server which is a subsystem of ssh. There is no inherent reason to disable sftp as it is just as secure as ssh.
I assume that your not really using vsftpd so disabling it is a good idea.
|
|
2 members found this post helpful.
|
All times are GMT -5. The time now is 11:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|