LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 04-18-2012, 07:33 AM   #1
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 50
setup FTP on Linux server which has static IP


I have Linux server which has static public IP, It means I can access this server from anywhere through internet.
I want to configure ftp on this server so I can upload files from anywhere.
How can I configure ftp?
I want to give username password for particular directory, so after putting username password, only that directory and its sub-directories should be accessible. User should not go anywhere else besides this directory.
 
Old 04-18-2012, 07:36 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
you would want to refer to standard documentation for the FTP server of your choice. I can suggest vsftpd if you have no preference already. For restrictions, look at chroot jailing users, as per their documents.
 
Old 04-18-2012, 07:42 AM   #3
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Original Poster
Rep: Reputation: 50
The vsftpd is installed on the server but I want to use filezilla to open directories.
How should I do this. I do not want to use command line ftp.
 
Old 04-18-2012, 08:52 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
your choice of client is irrelevant.
 
Old 04-18-2012, 09:25 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,628

Rep: Reputation: Disabled
Refer THIS link for vsftpd configuration. Make sure you have following lines in your configuration

Code:
anonymous_enable=NO 
chroot_local_user=YES
This will disable anonymous logins and will chroot the users to their home directories.
 
Old 05-15-2012, 01:30 AM   #6
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Original Poster
Rep: Reputation: 50
So how can I login through ssh to the server using static IP?
Code:
$ ssh username@111.45.xx.x
where 111.45.xx.x is static public IP of the server.
Right now when I use above command, it says
Code:
ssh: connect to host 111.45.xx.x port 22: Connection refused
Although it is working for LAN IP
Code:
$ ssh 192.168.2.8
username@192.168.2.8's password:
but through LAN IP I can not connect it outside LAN
I want to connect it using static IP outside LAN through ssh.
I do not want to connect it using LAN IP in Local Area Network through ssh.

Last edited by fortran; 05-15-2012 at 01:34 AM.
 
Old 05-15-2012, 01:37 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,628

Rep: Reputation: Disabled
Your ssh may be only listening on the private IP of the server and hence not accepting connections on port 22 on public IP. Configure ssh server to listen on public IP as well. And be aware of the consequences if you do not have proper security in place. Avoid remote root logins. Have very strong passwords and have firewall in place. Better off, have public key authentication rather than password authentication.
 
Old 05-15-2012, 02:51 AM   #8
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Original Poster
Rep: Reputation: 50
How can I configure/enable ssh for public IP ? I want to access server using username-password.
I have followed following steps.
1. Edit the file /etc/ssh/sshd_config
2. Set the listen address for my public IP and private IP.
ListenAddress 111.45.xx.x
ListenAddress 192.168.2.8
3. Restart the ssh server.
4. But when I run following command,
Code:
$ netstat -tulpn | grep :22
it gives me only one o/p for my private IP. It does not show my public IP in list.
Code:
tcp        0      0 192.168.2.8:22          0.0.0.0:*               LISTEN      9980/sshd
5. When I try to access my public IP using ssh, it gives me same error.
Code:
ssh: connect to host 111.45.xx.x port 22: Connection refused
 
Old 05-16-2012, 03:38 AM   #9
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,628

Rep: Reputation: Disabled
If you want sshd to listen on all the addresses, then use 0.0.0.0. It will listen on all the addresses.
 
Old 05-17-2012, 01:29 AM   #10
lonelyman
Member
 
Registered: May 2012
Location: Shanghai
Distribution: redhat,centos,fedora
Posts: 63
Blog Entries: 4

Rep: Reputation: Disabled
Maybe the iptables affects........Did you put some rules in the iptables chains to allow the ssh pass through ?

Last edited by lonelyman; 05-17-2012 at 01:30 AM.
 
Old 05-17-2012, 02:52 AM   #11
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Original Poster
Rep: Reputation: 50
The problem is solved.
The solution what I got is not related to this forum.
I have made a contact to my sys-admin. He closed the port 22, reset the router and opened the port again.
Now I am able to connect it through sftp. But I couldn't understand what was the problem.
Thank you very much for giving me your precious time and suggestions.
 
Old 05-17-2012, 03:23 AM   #12
lonelyman
Member
 
Registered: May 2012
Location: Shanghai
Distribution: redhat,centos,fedora
Posts: 63
Blog Entries: 4

Rep: Reputation: Disabled
om, congratulations!

Last edited by lonelyman; 05-17-2012 at 03:27 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How do I setup multiple FTP servers with distinct data sets with 1 master FTP server? tekky Linux - Networking 1 08-28-2009 06:00 AM
FTP server + static IP -> Firewall necessary ? Ben2210 Linux - Security 5 02-01-2005 04:43 PM
Iptable setup for a static ip and ftp trouble. wr3kt Linux - Networking 4 05-07-2004 02:57 AM
Setup a linux server, DNS, WEB, FTP, and Mail Server Help watermelon_lee Linux - Networking 1 08-26-2003 04:09 AM


All times are GMT -5. The time now is 06:46 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration