Showing posts with label FTP. Show all posts
Showing posts with label FTP. Show all posts

Error codes : FTP

0 comments

FTP is most widely used application using which you can manage upload download data for your website/server. While using FTP program you may come across many error or message which you need to understand and will have to react accordingly.
Following are few of them which you should know.
421 -: too many users logged to the same account.

530 -: It represent that wrong login password has been used


550 -: If the file exist it means you have no access to the file or dir. 550 error message stats that the account you have currently logged in does not have permission to perform the action you are trying to execute or you may be trying to upload to the wrong directory or trying to delete a file.


120 :- Service ready in nnn minutes.


125 :-  Transfer of data started, data connection is with server is open


150 :- File status okay; about to open data connection.


200 :- no error with fired command.


202 :- specified command is not implemented


211 :- System status


212 :- Shows directory status.


213 :- shows file status.


214 :- you can get meaning of a particular non-standard command very useful for non technical support guys.


220 :- Service ready for new user.


221 :- it stats that particular service is closing control connection.


225  :- Data connection open; no transfer in progress.


226  :- Closing data connection.


227  :- Entering Passive Mode


230  :- User logged in, proceed.


250  :- Requested file action okay, completed.


331  :- User name okay, need password.


332  :- Need account for login.


350  :- Requested file action pending further information


421  :- Service not available, closing control connection.


425  :- Can’t open data connection.


426  :- It indicates that connection is closed; and transfer is aborted.


450  :- Requested file action not taken.


451  :- Requested action aborted. Local error in processing.


452  :- Requested action not taken may be due to insufficient storage space in system.File unavailable (e.g., file busy).


500  :- Syntax error, command unrecognized. This may include errors such as command line too long.


501 :-  Syntax error in parameters or arguments.


502  :- Command not implemented.


503  :- Bad sequence of commands.


504  :- Command not implemented for that parameter.


530  :- Not logged in.


532  :- Need account for storing files.


550  :- Requested action not taken. Reason : File unavailable (e.g., file not found, no access).


551  :- Requested action aborted. Reason :  Page type unknown.


552  :- Requested file action aborted due to exceeded storage allocation (for current directory or dataset).


553  :- Requested action not taken. File name not allowed.

Script to email failed Ftp login attempts

0 comments

Shell Script to search Failed Ftp Login Attempts

This Shell script will search the server logs on daily basis and will email you the Failed Ftp Login Attempts of the day. The ftp logs are saved in the /var/log/messages file as by default there is no separate log file for Ftp in Linux.

Create a file /home/script/failedftp.sh and paste the below code:
#!/bin/bash

#Retrieve the current date

CUR_DATE=`date | awk ‘{print $2? ” $3}’`

#Create a temporary file to store the logs
touch /tmp/out.txt


echo “Failed Login Attempts on “$CUR_DATE”" > /tmp/out.txt

#Search the failed attempts and save in the temporary file

/bin/grep “$CUR_DATE” /var/log/messages | grep pure-ftpd | grep failed >> /tmp/out.txt

#Email the contents of the file to your email address
/bin/mail -s “Failed Ftp Login Attempts on “$CUR_DATE” ” youremail@yourdomain.com < /tmp/out.txt

Save the file. You now have to schedule a cron to execute the file once in a day to search logs. Edit the cron file
crontab -e

and add the following cron job
59 23 * * * /bin/sh /home/script/failedftp.sh

Note: This script will work with Pure-Ftpd server. You will have to edit the search string a bit according to your Ftp server.

Script to email successful Ftp logins

0 comments

Shell Script to email Successful Ftp Logins.


Note: This script will work with Pure-Ftpd server. You will have to edit the search string a bit according to your Ftp server.


This Shell script will search the server logs on daily basis and will email you the successful Ftp Logins of the day. The ftp logs are saved in the /var/log/messages file as by default there is no separate log file for Ftp in Linux.


Create a file /home/script/ftplogins.sh and paste the below code:



#!/bin/bash

#Retrieve the current date

CUR_DATE=`date | awk ‘{print $2? ” $3}’`

#Create a temporary file to store the logs
touch /tmp/out.txt


echo “Successful Ftp Logins on “$CUR_DATE”" > /tmp/out.txt

#Search the successful attempts and save in the temporary file

/bin/grep “$CUR_DATE” /var/log/messages | grep pure-ftpd | grep login >> /tmp/out.txt

#Email the contents of the file to your email address
/bin/mail -s “Successful Ftp Login Attempts on “$CUR_DATE” ” youremail@yourdomain.com < /tmp/out.txt

Save the file. You now have to schedule a cron to execute the file once in a day to search logs. Edit the cron file



crontab -e

and add the following cron job




59 23 * * * /bin/sh /home/script/ftologins.sh



How to hide folders to avoid deletion via FTP

0 comments

Hiding folders to avoid deletion via FTP


It is better to hide tmp/usr/lib/var folders via the conf file(when accessing ftp) so that these folders will not be accessed by the users.


If it is proftpd, find out the proftpd.conf


Add the following to the proftpd.conf file:



<Directory ~>
HideGroup wheel
</Directory>

<Directory ~>
HideNoAccess yes
</Directory>

Enter the directory path near to “<Directory >”, like “<Directory /var/www/vhosts/domainName/httpdocs/folder>”


After modification, restart the FTP.



«g?^g????_?????~g????-?¢?_g????~????_g????? ????PuShKaR

?»??_?????^?????_?????~??V?_????? – ?Ú?????«?

Ftp error “553 Disk full - please upload later”

0 comments

Problem: You get the ftp error “553 Disk full - please upload later”, even when the quota of the user has not

been exceeded and the disk partition in which all the user accounts reside (say /dev/sda5) is not full.

Cause: The value of the variable ‘MaxDiskUsage’ in the pure-ftpd configuration file (/etc/pure-ftpd.conf ) will

be equal to or less than the percent use of the partition.

——————————————–

root@ [~]# grep MaxDiskUsage /etc/pure-ftpd.conf

MaxDiskUsage 90

——————————————–

# df

Filesystem Size Used Avail Use% Mounted on

/dev/sda5 144G 59G 78G 90% /

——————————————–

Last: Change the MaxDiskUsage value to 99 (Some high value) and restart pure

Problem: You get the ftp error “553 Disk full - please upload later”, even when the quota of the user has not been exceeded and the disk partition in which all the user accounts reside (say /dev/sda5) is not full.

Cause: The value of the variable ‘MaxDiskUsage’ in the pure-ftpd configuration file (/etc/pure-ftpd.conf ) will

be equal to or less than the percent use of the partition.

——————————————–

root@ [~]# grep MaxDiskUsage /etc/pure-ftpd.conf

MaxDiskUsage 90

——————————————–

# df

Filesystem Size Used Avail Use% Mounted on

/dev/sda5 144G 59G 78G 90% /

——————————————–

Last: Change the MaxDiskUsage value to 99 (Some high value) and restart pure



Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar





Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar


Restrict users to their home directory in VSFTP

0 comments
Sometimes you may want to restrict users to their home directory while doing FTP. You can achieve this in VSFTP with the

following steps.

1. Open the VSFTPD configuration file “/etc/vsftpd.conf” . Uncomment the following lines.

chroot_local_user=YES

chroot_list_file=/etc/vsftpd.chroot_list

2. Create the file “/etc/vsftpd.chroot_list” and place the user names (one per line) that you want to restrict in that file.

3. Restart VSFTPD to take effect.

# /etc/init.d/vsftpd restart

After this users listed in the file “/etc/vsftpd.chroot_list” will be locked up in their home directory
Sometimes you may want to restrict users to their home directory while doing FTP. You can achieve this in VSFTP with the


following steps.


1. Open the VSFTPD configuration file “/etc/vsftpd.conf” . Uncomment the following lines.


chroot_local_user=YES

chroot_list_file=/etc/vsftpd.chroot_list

2. Create the file “/etc/vsftpd.chroot_list” and place the user names (one per line) that you want to restrict in that file.


3. Restart VSFTPD to take effect.


/etc/init.d/vsftpd restart

After this users listed in the file “/etc/vsftpd.chroot_list” will be locked up in their home directory

How to Setup the firewall for Passive FTP

0 comments
Setting up the firewall for Passive FTP: (APF Firewall)

1.Open your APF configuration file with your favorite editor. This configuration file is usually located at: # /etc/apf/conf.apf

# vi /etc/apf/conf.apf

2. Select a port range to use for the passive FTP connection, and find the line that looks like this:

IG_TCP_CPORTS=”20, 21, 22, 25, 53, 80, 110, 143, 443, 465, 993, 995, 2082, 2083, 2086, 2087, 2095, 2096, 3306?

If this list of ports already includes a port range above 20000, then you can skip onto configuring your FTP Server, but remeber the range listed. (20000 to 30000 would be written as 20000_30000)

3. Add the port range to the end of the line and within the quotation marks(”). Remeber each port/port range is seperated by a comman(,), and a port range between 35000 to 36000 is written as 35000_36000 .

IG_TCP_CPORTS=”20, 21, 22, 25, 53, 80, 110, 143, 443, 465, 993, 995, 2082, 2083, 2086, 2087, 2095, 2096, 3306, 35000_36000?

3. Save and restart your firewall.

To restart your firewall:

/etc/init.d/apf restarts not.

Setting up the firewall for Passive FTP: (APF Firewall)


1.Open your APF configuration file with your favorite editor. This configuration file is usually located at:


# /etc/apf/conf.apf


# vi /etc/apf/conf.apf


2. Select a port range to use for the passive FTP connection, and find the line that looks like this:


IG_TCP_CPORTS=”20, 21, 22, 25, 53, 80, 110, 143, 443, 465, 993, 995, 2082, 2083, 2086, 2087, 2095, 2096, 3306?


If this list of ports already includes a port range above 20000, then you can skip onto configuring your FTP Server, but remeber the range listed. (20000 to 30000 would be written as 20000_30000)


3. Add the port range to the end of the line and within the quotation marks(”). Remeber each port/port range is seperated by a comman(,), and a port range between 35000 to 36000 is written as 35000_36000 .


IG_TCP_CPORTS=”20, 21, 22, 25, 53, 80, 110, 143, 443, 465, 993, 995, 2082, 2083, 2086, 2087, 2095, 2096, 3306, 35000_36000?


3. Save and restart your firewall.


To restart your firewall:


/etc/init.d/apf restarts not.

Shell script to copy all files recursively and upload them to remote FTP server

0 comments
#!/bin/bash
# Shell script to copy all files recursively and upload them to
# remote FTP server (copy local all directories/tree to remote ftp server)

# If you want to use this script in cron then make sure you have
# file pointed by $AUTHFILE (see below) and add lines to it:
# host ftp.myxyz.com
# user myftpuser
# pass mypassword
#
#!/bin/bash
# Shell script to copy all files recursively and upload them to
# remote FTP server (copy local all directories/tree to remote ftp server)
#
# If you want to use this script in cron then make sure you have
# file pointed by $AUTHFILE (see below) and add lines to it:
# host ftp.mycorp.com
# user myftpuser
# pass mypassword
#
# This is a free shell script under GNU GPL version 2.0 or above
# Copyright (C) 2005 nixCraft
# Feedback/comment/suggestions : http://cyberciti.biz/fb/
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------

FTP="/usr/bin/ncftpput"
CMD=""
AUTHFILE="/root/.myupload"

if [ -f $AUTHFILE ] ; then
# use the file for auth
CMD="$FTP -m -R -f $AUTHFILE $myf $remotedir $localdir"
else
echo "*** To terminate at any point hit [ CTRL + C ] ***"
read -p "Enter ftpserver name : " myf
read -p "Enter ftp username : " myu
read -s -p "Enter ftp password : " myp
echo ""
read -p "Enter ftp remote directory [/] : " remotedir
read -p "Enter local directory to upload path [.] : " localdir
[ "$remotedir" == "" ] && remotedir="/" || :
[ "$localdir" == "" ] && localdir="." || :
CMD="$FTP -m -R -u $myu -p $myp $myf $remotedir $localdir"
fi

$CMD

What is FTP?

0 comments
FTP is an acronym for File Transfer Protocol. As the name suggests, FTP is used to transfer files between computers on a network, such as the Internet. You can use FTP to exchange files between computer accounts, to transfer files between an account and a desktop computer, or to access software archives on the Internet. Keep in mind, however, that many FTP sites are heavily used and require several attempts before connecting.

An FTP address looks a lot like an HTTP, or Website, address except it uses the prefix ftp:// instead of http://.

An FTP Client is software that is designed to transfer files back-and-forth between two computers over the Internet. It needs to be installed on your computer and can only be used with a live connection to the Internet.

How to Wget with FTP

0 comments
Here are some useful commands to download data from an account which is exist on different server.

wget ftp://username:password@ftp.domainname.com * -r

eg : wget ftp://test:celita0201@ftp.domainname.com * -r

OR

wget ftp://ftp.domainname.com/* --ftp-user=username --ftp-pass=password -r

wget ftp://ftp.domainname.com/* --ftp-user=test@domainname.com --ftp-pass=neHGyxhjr -r


Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

How to Change Your FTP Port

0 comments
Lately FTP has been a problem for a lot of hosting providers. Especially since the recent influx of Gumblar-related attacks and FTP exploits, some hosting providers are now considering changing their FTP ports as an added measure of security. If you’re on a cPanel server you have a couple extra steps to go through, but it’s a rather easy change.

Pure-FTP


1) Edit /etc/pure-ftpd.conf and look for the following line:

Bind <addr> <port>

Where <addr> is a publically routable IP.  The default example, 127.0.0.1, will cause the socket to bind locally but then this connection won’t serve externally. <port> is the new port you wish to put the service on.

2) If necessary, add the new FTP port to your server’s firewall

3) Edit /etc/chkserv.d/ftpd and change the port, which is the first comma-separated entry to the right of ‘=’ on the line in the file, to match the port you put the service on.

Finally:
/etc/init.d/pure-ftpd restart
/etc/init.d/cpanel restart (restarts tailwatchd/chkservd)

ProFTP


Edit /etc/proftpd.conf and change:

Port 21

Then make sure to test to make sure FTP is working before notifying your users!

FTP error 530 Login incorrect

6 comments
First of all check which FTP is using the Cpanel proftpd or pureftpd

If it is using the proftpd, do the folowing to fix the 530 error
1. First of all try the /scripts/ftpupdate
2. grep /etc/proftpd/passwd.vhosts (here is the domain username)
3. If it is not present there then grep /etc/proftpd/
4. Check details and cat >> /etc/proftpd/passwd.vhosts
5. Paste the main ftp account details in this file
6. /scripts/restartsrv_ftpserver

Note: please be careful in doing it. If you have specified cat > /etc/proftpd/passwd.vhosts, it w
ill overwrite the whole content.

If it is pureftpd:
Do the above 6 steps
7. Sometimes you need to rum "/usr/sbin/pure-uploadscript -B -r /usr/local/bin/ftpfilter" also