0

I'm not a server guru, just about know how to edit php.ini and few other bits, however I've been given a VPS to work with and keep getting connection refused when trying to connect to FTP,

Googled for a while but didn't find much about what to do,

I tried running

[root@s1 /]# rpm -q iptables
iptables-1.3.5-5.3.el5_4.1
[root@s1 /]# lsmod | grep ip_tables -L
(standard input)
[root@s1 /]# system-config-securitylevel
-bash: system-config-securitylevel: command not found

Could anyone tell me how I would go about opening the port 21 to be able to use FTP?

5
  • Is there an FTP process actually running? ps auxw |grep ftp
    – cjc
    Apr 22, 2012 at 23:58
  • Yes sorry didn't post that root 7978 0.0 0.0 7188 788 pts/1 S+ 03:50 0:00 grep ftp Apr 23, 2012 at 0:01
  • 2
    @SauliusAntanavicius - are you sure that's not your grep ftp command being matched?
    – Kev
    Apr 23, 2012 at 0:10
  • @Kev I'm affraid I lack knowledge whenit comes to that sort of a thing, how canI check? or start FTP? Apr 23, 2012 at 0:11
  • wouldn't it be ftpd or vsftpd ? Apr 25, 2012 at 15:36

2 Answers 2

3

Here's the CentOS/RHEL documentation on setting up an FTP server:

http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-ftp-servers.html

(that's for CentOS/RHEL 5, but it should generally apply to 6)

Follow those instructions if you haven't actually installed and configured the FTP software.

4
  • Could I not just usethe normal FTP? the one running root 7978 0.0 0.0 7188 788 pts/1 S+ 03:50 0:00 grep ftp Apr 23, 2012 at 0:04
  • That's not FTP service process. It's your own search for an ftp process. If that's the only line you see, then there's no ftp daemon running. You'll have to start it. Take a look at the above guide.
    – cjc
    Apr 23, 2012 at 0:20
  • Thank you, I've set up the FTP however two questions, I can't seem to access via root, i've added it to the vi /etc/vsftpd/chroot_list and then restarted the vsftpd. How would I go about creating a user/folder for making a folder and then assigning a brand new user to it in let's say home/ What I need is to create a folder, create a new user with FTP privileges just for that folder and set it's password, however I need to do this via SSH over PHP(so I don't think I can do things such as vi?) Would seriously appreciate if you could help out! Apr 23, 2012 at 3:07
  • You absolutely should not have the root user be able to FTP. That's poor security practice, especially since FTP is not encrypted. If you had to do that to set up an FTP user, you should remove the root user now.
    – cjc
    Apr 23, 2012 at 10:54
1

You generally shouldn't use FTP on modern Linux systems like CentOS 6.2 . Since SSHD 5.x versions all have a FTP subsystem in them, FTP of old is now no longer necessary, and the modern way of doing it is just to go into your services control panel and enable the SSHD daemon. Then, you can connect with putty.exe and psftp.exe , or any other FTP client like Tunnelier, etc. SFTP runs on port 22 typically.

This is done quite easily.

Add user as usually and assign him a password. Then run the following command (replace the 'username' with real user name):

root@host # usermod -s /usr/lib/sftp-server username

This changes user's shell to sftp-server.

The last step for this to work is to add '/usr/lib/sftp-server' to /etc/shells to make it a valid shell, eg. like this:

root@host # echo '/usr/lib/stfp-server' >> /etc/shells

There. Now you've setup a user who can only access your server with SFTP.

You can restrict SSHD further by adding these configurations to the SSHD config:

AllowTcpForwarding     no
PermitTunnel           no
6
  • Someone asking for information on setting up an FTP likely doesn't want to also give those people shell access. Your recommendation is incomplete and could lead to problems for someone ignorantly following this recommendation. There are a multitude of security issues that come with wanting only SFTP access via OpenSSH.
    – brent
    Apr 25, 2012 at 15:52
  • @brent - ok , I fixed my answer. Thanks for noticing that.
    – djangofan
    Apr 25, 2012 at 20:23
  • This is exactly what I was referring to with security issues. The solution you provided still allows a user to connect via SSH and use it as a proxy
    – brent
    Apr 25, 2012 at 21:01
  • @brent - true, but without a working shell, what are they going to launch?
    – djangofan
    Apr 27, 2012 at 19:09
  • The user could be compromised then used to proxy traffic like fraud, blackhat activity, etc. Run any services that are limited to localhost access only? They can access those remotely now as well.
    – brent
    Apr 27, 2012 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .