LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   vsftpd bash ftp command not found (https://www.linuxquestions.org/questions/linux-newbie-8/vsftpd-bash-ftp-command-not-found-940385/)

paruhang 04-18-2012 01:06 AM

vsftpd bash ftp command not found
 
hellow everybody,
iam new to linux and using centos 6.2. i had install successfully vsftpd in my local machine.

rpm -q vsftpd
vsftpd-2.2.2-6.el6_2.1.i686

and it is running

service vsftpd status
vsftpd (pid 1880) is running...

chkconfig vsftpd on

my local ip is :10.10.10.163

and i have created account guest while trying to login ftp from guest, this error occurs:

[guest@workstation Desktop]$ ftp 10.10.10.163
bash: ftp: command not found

so can anyone give me instruction to run ftp on local machine or do i have to install ftp client if yes is it possible to install ftp server and client in one machine. i'll be greatful any kinds of ideas and suggestions are welcome.


thank you in advance.

cliffordw 04-18-2012 01:32 AM

Hi there,

You're on the right track. vsftpd is the FTP server, and you do need to install an FTP client too. To answer your question, yes you can install both a client and server on the same machine.

Hope this helps:-)

Satyaveer Arya 04-18-2012 09:19 AM

Code:

# yum install ftp

paruhang 04-19-2012 04:02 PM

thankx,
cliffordw and Satyaveer Arya for your quick reply.

i have installed vsftpd and ftp on my local machine

# rpm -q vsftpd
vsftpd-2.2.2-6.el6_2.1.i686

# rpm -q ftp
ftp-0.17-51.1.el6.i686

while iam trying to start,stop my vsftpd it works

service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]

but i can't start,stop my ftp using "service ftp start or stop"

# service ftp start
ftp: unrecognized service

# service ftp stop
ftp: unrecognized service

# service ftp status
ftp: unrecognized service

do i have to start ftp or it run automatic. if i have to start ftp client how can i do that..? and i have one more questions the following are /etc/vsftpd/ftpusers, /etc/vsftpd/user_list and /etc/vsftpd/vsftpd.conf respectively

# cat ftpusers
# Users that are not allowed to login via ftp
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody

# cat user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody

# cat vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

my local ip = 10.10.10.161
i have two users = khem and guest

while trying to ftp using khem following errors occurs

# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): khem
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/khem
Login failed.

and while trying to ftp using guest following errors occurs

# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): guest
530 Permission denied.
Login failed.

userlist_enable=YES and userlist_deny=YES. if both userlist_enable=YES and userlist_deny=YES, any users created in local machine can ftp in local machine, if iam not wrong. but i can't ftp using different users and i haven't edit vsftpd.cond. what i want to do is, i want to ftp on my local machine using different user accounts so how can i do that, can any one help me i'll be greatful and any kinds of ideas n suggestions are welcome

THANK YOU IN ADVANCE

cliffordw 04-20-2012 12:01 AM

Hi again,

To answer your first question about the ftp service: The ftp client is not a service that needs to be started. The package contains the ftp client command you are using.

For the khem user the problem does not appear to be related to the user_list or ftpusers files, as it would not prompt you for the password it that was the issue. It appears to be related to the home directory. Can this user log in on the console or via ssh?

For the guest user I'm not sure what the problem is. Which shell are you using for that user? Does the user have a password or not (I'm asking because some distros apparently ship with a guest account with no password, and pam might not like that for insecure connections).

Satyaveer Arya 04-20-2012 03:36 AM

Quote:

# service ftp start
ftp: unrecognized service

# service ftp stop
ftp: unrecognized service

# service ftp status
ftp: unrecognized service
There is no service names 'ftp', it's only vsftpd and that you have already run.
ftp package which I mentioned in my first post was for ftp client.

And if you want to ftp with the user 'khem' and 'guest', you should have these user's entry in /etc/vsftpd/user_list. Your /etc/vsftpd/vsftpd.conf file's entries are all right.
And also make sure that these users are already created by super user means by 'root' with their respective home directory.
Good Luck!

paruhang 04-20-2012 12:22 PM

thankx,
cliffordw and Satyaveer Arya for your quick reply.

the first and second post is for cliffordw and satyaveer respectively.

1) for cliffordw

i haven't change vsftpd.conf, user_list and ftpusers, when iam trying to ftp with users 'khem' or 'guest' the following error occurs:

trying to ftp with user khem it prompt for password after inserting password the error 500 OOPS: cannot change directory:/home/khem, login failed

# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): khem
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/khem
Login failed.

and again trying to ftp with user guest

# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): guest
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/guest
Login failed.

the same errors occours as user khem.


ABOUT CONSOLE OR VIA SSH, my local ip is 10.10.10.161

now iam login with user guest and trying to login with via ssh with my local machine

[guest@workstation ~]$
[guest@workstation ~]$ ssh khem@10.10.10.161
khem@10.10.10.161's password:
Last login: Fri Apr 20 18:41:04 2012 from workstation
[khem@workstation ~]$

hope user khem can login colsole or via ssh, if iam not wrong i just try it by googeling.
iam using default centos 6.2 shell may be it is bash.
ya both user khem and guest have password.



----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



2) for Satyavee

as i follow your guidelines given in above post i have insert user khem and guest in /etc/vsftpd/user_list and i save it and exit

# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
khem
guest
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody

after save and exit i have restart vsftpd

# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]

and trying to ftp using both user 'khem' and 'guest' respectively

ftp using khem

# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): khem
530 Permission denied.
Login failed.


ftp using guest

# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): guest
530 Permission denied.
Login failed.

ya i have created user khem and guest by root user and i gave password to them


once again thank you for your ideas and suggestions, can anybody guide me to configure ftp by analysing this post. i'll be greatful.
THANK YOU IN ADVANCE

paruhang 04-21-2012 06:08 PM

hi everybody,
i am here to announce that i have solve my problems:

# getenforce
Enforcing

If it's in enforcing mode, we need to check if ftp_home_dir boolean is set to on:

getsebool -a | grep ftp_home_dir

If that's off, turn it on to allow ftp user's to get into their home directory:

setsebool -P ftp_home_dir=1

lastly i remove user 'khem' and 'guest' from /etc/vsftpd/user_list and save it,


# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): khem
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.


# ftp 10.10.10.161
Connected to 10.10.10.161 (10.10.10.161).
220 (vsFTPd 2.2.2)
Name (10.10.10.161:khem): guest
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

iam really greatful to cliffordw and Satyaveer Arya for your ideas, suggestion and guidelines.
THANK YOU.


All times are GMT -5. The time now is 04:54 PM.