66
Method 1: Changing the user's home directory
Make sure the following line exists
chroot_local_user=YES
Set user HOME Directory to /var/www/ , if you want to change for existing user then you can use:
usermod --home /var/www/ username
then set required permission on /var/www/
Method 2: Use user_sub_token
If you don't want to change user's Home ...
34
Give this a try:
$ lftp
lftp :~> set ftp:ssl-force true
lftp :~> connect ftp.domain.tld
lftp ftp.domain.tld:~> login <username>
NOTE: If the server is making use of self signed certificates you may need to add this set as well:
lftp :~> set ssl:verify-certificate no
29
Your ftp server needs a channel to transfer data. Port 21 is used to establish the connection. So to make data transfer possible you'd need to enable port 20 as well. See the following configuraton
First load the following module to make sure passive ftp connections are not rejected
modprobe ip_conntrack_ftp
Allow FTP connections on port 21 incoming and ...
answered Oct 4 '13 at 12:03
Valentin Bajrami
7,95422 gold badges2222 silver badges3838 bronze badges
22
Your first command should work without whitespaces:
curl -T "{file1.txt,file2.txt}" ftp://XXX/ -user YYY
Also note the trailing "/" in the URLs above.
This is curl's manual entry about option "-T":
-T, --upload-file
This transfers the specified local file to the remote URL. If there is no file part in the specified URL, Curl will append the local ...
22
FTP is not a remote shell like SSH or telnet. FTP is a protocol with only a few select commands. See the standard RFC 959 for details about the supported commands.
The various terminal interfaces which exist and the various graphical FTP clients essentially just translate some local commands or clicks into a FTP command. For example many terminal clients ...
18
I saw such extensive rules already in several Blogs etc. and wondered why not simply use
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
together with the nf_conntrack_ftp module. This is more concise and readable, which is generally a good thing, especially with firewalls...
FWIW,...
18
When you define an alias, the command you set is run instead of the one you wrote. This means that when you run ftp abc.com, what is actually executed is
echo do not use ftp. Use sftp instead abc.com
A simple solution is to use a function instead of an alias:
ftp(){ echo 'do not use ftp. Use sftp instead'; }
Alternatively, you could use printf as ...
16
alias ftp='echo do not use ftp. Use sftp instead. # '
answered Nov 26 '14 at 11:09
Hauke Laging
73.3k1717 gold badges111111 silver badges161161 bronze badges
15
For SSH:
tar czf - . | ssh remote "( cd /somewhere ; cat > file.tar.gz )"
For SFTP:
outfile=/tmp/test.tar.gz
tar cvf $outfile . && echo "put $outfile" | sftp remote:/tmp/
Connecting to remote...
Changing to: /tmp/
sftp> put /tmp/test.tar.gz
Uploading /tmp/test.tar.gz to /tmp/test.tar.gz
/tmp/test.tar.gz
Another SFTP:
outfile=/tmp/test.tar....
15
You might be looking for rcp, it performs remote execution via rsh so you will have to rely on that and have in mind that all communication are insecure.
14
Non-chroot access
If you don't have a FTP server setup, and you trust the user that will be logging in, not to go poking around your server too much, I'd be inclined to give them an account to SFTP into the system instead.
The CentOS wiki maintains a simple howto titled: Simple SFTP setup that makes this pretty pain free.
I say it's pain free because you ...
14
Your approach is not taking in account that contrary to other common protocols, FTP uses both port 20 and port 21 over TCP by default.
The term passive refers that the protocol is slightly better behaved than the initial implementations.
Here is a link:
http://www.slacksite.com/other/ftp.html
Port 20/TCP is used for data, and port 21/TCP for commands. ...
answered Dec 25 '15 at 16:18
Rui F Ribeiro
49.1k2121 gold badges115115 silver badges188188 bronze badges
13
There is most likely a NAT-firewall between you and the servers showing the symptom. (NAT-firewalls hide a whole network behind a single IP-number).
The problem is that ftp wants to send the data resulting from the command in a new, separate TCP/IP connection and that cannot go through the firewall because it needs to go from the server to you, and you are ...
13
You cannot disable encryption completely on ssh/scp but you can force it to use a weaker cipher that is much less cpu intensive. Make sure that compression is not turned on in your ssh_config or on the command line and add -c arcfour,blowfish-cbc to your scp command line to select weaker ciphers.
13
you can't exactly do it with a command line option, but what you can do is redirect stdin like so:
$ ftp -n ftp.backupte4.rsyncbackup.info << EOF
> quote USER bapte
> quote PASS b2p7Ua2
> put somefile <-- this is the command you want to execute
> quit
> EOF
or you can put it in a script:
#!/bin/sh
ftp -n ftp.backupte4.rsyncbackup....
12
You can log sftp, try this:
In /etc/ssh/sshd_config file, change this line:
Subsystem sftp /usr/libexec/openssh/sftp-server
to:
Subsystem sftp /usr/libexec/openssh/sftp-server -l INFO -f AUTH
Then config syslog log facility AUTH to your file. In Centos 6. edit /etc/rsyslog.conf, add this line:
auth.* /var/log/sftp.log
After making ...
11
FTP has quite a few commands. While the client maps some of these to a more userfriendly text interface.
For example, if you use ftp -v (depending on your ftp client, the one I use needs ftp -vd), you'll notice something like the following (---> shows what is sent to the server):
$ ftp -vd ftp.debian.org
Connected to ftp.debian.org.
220 ftp.debian.org ...
11
I found the answer as below.
in passive mode we can run ls command but in active mode we have to manually disable passive mode by typing passive command then it will accept ls command otherwise it's gives 550 permission denied error . see below (pasv_enable=NO in vsftpd.conf)
ftp> passive
Passive mode on.
ftp> ls
550 Permission denied.
Passive mode ...
11
lftp would do this with the command mirror -R -P 20 localpath - mirror syncs between locations, and -R uses the remote server as the destination , with P doing 20 parallel transfers at once.
As explained in man lftp:
mirror [OPTS] [source [target]]
Mirror specified source directory to local target directory. If target
directory ends with a ...
11
I wrote this quick script:
#!/bin/bash
ssh "$1" "nc -l 2020 > \"$2\" &"
pv "$2" | nc "$1" 2020
It takes two args, the host to send it to and the file you are sending. It only works for one file. It uses ssh to start a netcat listening on the opposite end and then uses netcat to send it to that listening port. I added pv to the start to give a nice ...
11
Use a .netrc file in your home directory.
The content is:
# machine <hostname> login <username> password <password>
machine ftp.example.com login myuser password $ecret
If this is something you're doing programmatically, write the .netrc before connecting, delete it when you're done.
10
I think it depends more on the client that you're using. Take a look at the client, lftp. There's a good tutorial on using it here, titled: Unix: Flexibly moving files with lftp.
If you look through the help for lftp you'll notice the command mv.
$ lftp
lftp :~> help
!<shell-command> (commands) ...
10
I had same error after PASS command in CENTOS 7. (GnuTLS error -15: An unexpected TLS packet was received.)
My solution is following:
I had to add following to vsftpd.conf:
allow_writeable_chroot=YES
chroot_local_user=YES
local_root=/ftphome/$USER
user_sub_token=$USER
9
The best way, is to use SFTP from SSH and jail the user.
in file: /etc/ssh/sshd_config
make sure this line is uncomented:
Subsystem sftp internal-sftp
Then configure the rule to match a group:
Match group sftponly
ChrootDirectory /home/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
and lastly ...
9
I think NFS is quite underrated for this sort of task, where you want convenience, speed and don't care about security. NFS is really simple to set up, especially on the client: see this short guide for ubuntu, together with this longer ubuntu community help page. From the client's perspective you just mount the server directory and it looks just like a ...
9
There is a post here that describes the problem. The new kernel module seccomp is used automatically by vsftpd since version 3.0.0. vsftpd is a bit buggy when using seccomp.
Add this line to the end of /etc/vsftpd.conf
seccomp_sandbox=NO
and restart the Server:
sudo service vsftpd restart
answered May 26 '14 at 4:34
Kshitiz Sharma
7,3431313 gold badges4848 silver badges6666 bronze badges
9
Just put a space and the comment character # at the end of the alias string:
alias ftp='echo do not use ftp. Use sftp instead. #'
ftp abcd.com
do not use ftp. Use sftp instead.
This will cause the parameters to be treated as a comment. Just do not forget to add a space before # otherwise it will not be interpreted as a separate token after the alias ...
9
Use bind mount instead of symlink:
rm /home/guirec0/int
mkdir /home/guirec0/int
mount --bind /disk2/clients/optik/int /home/guirec0/int
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
ftp × 561vsftpd × 98
linux × 69
permissions × 55
centos × 48
ubuntu × 45
sftp × 34
ssh × 27
shell-script × 25
debian × 24
proftpd × 23
iptables × 21
lftp × 20
bash × 17
networking × 16
rhel × 16
curl × 16
filezilla × 15
wget × 14
security × 13
users × 13
shell × 12
apache-httpd × 12
command-line × 11
backup × 11