8

I want to stop ftp and remove the service on Ubuntu 14.04

I tried sudo apt-get remove ftp and checked using command ps aux | grep ftp but the service was still running.

Please suggest some way to stop it.

MrVaykadji
  • 5,875
  • 2
  • 32
  • 55
Dattatray
  • 83
  • 1
  • 1
  • 3
  • Which FTP service did you install ? – NGRhodes Jun 09 '14 at 10:30
  • Frankly speaking, I have not installed ftp service (or dont know if anyone else installed on it). I installed Ubuntu 14.03 on my new laptop. After executing command "ps aux | grep ftp" i am getting output " 5587 0.0 0.0 15940 920 pts/6 S+ 13:31 0:00 grep --color=auto ftp". Can you please suggest a way to check which ftp service is running. While doing troubleshooting i executed remove command for vsftpd, proftpd,.... etc. – Dattatray Jun 09 '14 at 11:43
  • Sorry for the confusion, but I have realised you have made a mistake, see my new answer below. – NGRhodes Jun 09 '14 at 12:09
  • Are you trying to preserve sftp access at the same time? Have you run a nmap scan of the system to see which ports are open? Need a bit more information. – SDsolar Jul 24 '17 at 06:31

6 Answers6

16

To stop the service:

sudo service vsftpd stop

To remove the service

sudo apt-get remove vsftpd
user.dz
  • 48,105
NGRhodes
  • 9,490
  • Thanks for the answer. I tried command to stop but i am getting output as "vsftp: unrecognized service". – Dattatray Jun 06 '14 at 11:31
  • same output for vsftpd :( "vsftpd: unrecognized service" – Dattatray Jun 09 '14 at 08:04
  • 2
    Regardless of the OP's system state - this answer answers the question for others looking to actually uninstall vsftpd (a basic ftp service). For those looking to see what ftp service they have running they can use the command: sudo netstat -ntpl – TomO Mar 01 '16 at 03:29
  • Turns out I needed this. Great work. – Rick Henderson Dec 09 '16 at 02:00
  • If vsftpd is enabled there probably is a good reason, like sftp. It would be a bit of an overreaction to just stop it all rather than work on the config file to simply shut off anonymous access. – SDsolar Jul 24 '17 at 06:30
5

I don't know why I did not spot this earlier. I've left my other answer alone to avoid confusion

There is no FTP service

What you are seeing when you are running ps aux | grep ftp is the process of the same command.

There are better ways of searching the process using the commands pgrep or pidof. Simple way to run these:

pgrep ftp
pidof ftp

In both cases will simply return the PID if there is a process running of the name given or nothing if no process found of the given name.

NGRhodes
  • 9,490
  • Thanks @NGRhodes. After executing above commands i do not found any ftp service. It conclude that ftp is not running on my machine. But do you know why i am getting output to "ps aux | grep ftp" ? – Dattatray Jun 09 '14 at 13:33
  • 1
    The command is finding itself in the process list :) – NGRhodes Jun 09 '14 at 13:42
3

First of all you will have to identify which FTP server you are running because there are a lot (vsftpd, pro-ftpd, ...). I suggest that you do dpkg -l|grep ftpd to see which FTP daemon is installed. The name of the service to use is usually the name of the displayed package without the version number, e.g. proftpd or pure-ftpd or anything other depending of your installation.

When you have identified in the output the name of the FTP server package, just do :

sudo stop <name>

if you get an error like <name>: unknown job this is because is not upstart enabled. Then simply try :

sudo service <name> stop

Then, just remove the package using the standard command :

sudo apt-get remove <name>

or (if you want to get rid of all config files and so on) :

sudo apt-get purge <name>
Benoit
  • 7,567
  • 1
  • 25
  • 34
  • Tried command "dpkg -l|grep ftpd" but not getting any output. When i am executing an command "ps aux | grep ftp" i am getting output "+ 5587 0.0 0.0 15940 920 pts/6 S+ 13:31 0:00 grep --color=auto ftp" – Dattatray Jun 09 '14 at 08:06
  • 1
    The you have no FTP server running nor installed. – Benoit Jun 10 '14 at 09:57
0

For Ubuntu 20.04 ( and if you are installed vsftpd )

$ sudo systemctl stop vsftpd

will stop the service

then...

$ sudo apt-get remove --purge vsftpd
cocomac
  • 3,394
0

vsftpd delete process:

ps aux | grep ftp
sudo apt-get remove vsftpd
ps aux | grep ftp

sudo apt-get remove --purge vsftpd
service vsftpd status

karel
  • 114,770
0

Firstly check which package/service is responsible for your FTP service:

$ service --status-all 2>&1 | grep ftp
 [ - ]  proftpd

If it's still not clear, check by:

sudo netstat -ap | grep ftp

Then remove it (apt will automatically stop the service):

$ sudo apt-get remove proftpd-basic
Removing proftpd-mod-vroot ...
Removing proftpd-basic ...
[ ok ] Stopping ftp server: proftpd.

If it's not proftpd, then change to whatever package which deals with your FTP service.

Test with telnet:

$ telnet localhost ftp

If you've got Connection refused, then your server is more secured.

kenorb
  • 10,347