Tag Info

New answers tagged

2

At least OpenSSH sets different TOS bits (0x16 for interactive sessions, 0x08 for bulk transfers), as discussed on quora. This can be easily exploited using rules that match those bits. It seems the highest matching QoS takes effect, make sure not to have a general rule for port 22/SSH around: OpenWRT by default ships a rule matching SSH and DNS together. ...


1

Personally, if the goal is to just allow the copying of files to the server, I would go the route of sftp instead of scp. scp presumes ssh access and if there is no need to provide shell access, better not to try and lock it down for just file transfers. So, sftp. Some recommendations. Disable normal FTP and instead run something that allows you to easily ...


2

If you want all setup all the limiting stuff you mention I would suggest to use ProFTPd. Using the sftp_module you are able to only allow a secure session. See http://www.proftpd.org/docs/contrib/mod_sftp.html for details about the sftp functionality. Near the bottom of the page an example configuration is listed. Using the DefaultRoot directive you can ...


2

You could wrap the scp in a sg command. For example: sg yourgroup scp ....


2

I suspect there's no myip recorded in /root/.ssh/known_hosts. Please try once sudo ssh root@myip interactively before running that script. Alternatively, you can disable host key checking: #!/bin/bash -v sshpass -p '<pypasswd>' scp -o StrictHostKeyChecking=no blah.img root@myip:/home/user/blah.img exit 0


1

Your root user doesn't have the same private keys that you are using when not running as root. Therefore, as root, you cannot copy the material. Try copying adding ~/.ssh/id_rsa to /root/.ssh/id_rsa (or some other private key you are using to connect to myip). Alternatively let the sudo do the other things, and change back to the "normal" user in the ...


0

I had the same bad experience. I slight modification of the .bashrc on the remote system was the problem. I once added 'ulimit' and got the this problem during the next scp (ssh worked). After removing this line all was fine.


1

You would have to run some program under an Apache server that handles requests to where to put the files and authentication based on the url and data supplied. There are of course CMS systems that offer you all that, but none with the ease of use uploading multiple files like you can do with scp. The shell based programs would all upload one at a time ...


1

You could use the ~/.ssh/authorized_keys to restrict what the users can do; command="/noscp.sh" ssh-dss blablabla== whatever@user.email ; #!/bin/sh if [[ "$SSH_ORIGINAL_COMMAND" =~ scp* -a ! "$SSH_CLIENT" =~ 10.10.10.10* ]] ; then echo "Rejected" >&2 echo "$(date) fail $SSH_CLIENT $SSH_ORIGINAL_COMMAND" >> noscp.log exit 1 else ...


0

Yes. If you issue the command sshpass -p'password' scp file user@server: it will copy file to the default home directory of user on server server.


0

If the remote server supports SFTP and the client allows FUSE, then mount the remote directory over SSHFS. You can then work without having to worry about local vs remote files: they'll all be files. mkdir ~/mnt sshfs login@some.cluster.nl:/path/to/folder ~/mnt Now you need to copy the files owned by certain users to the ~/mnt directory. To do this for ...


4

The most efficient and safe way is probably find | tar | tar: ssh login@some.cluster.nl 'cd /path/to/folder; find . \( -user owner1 -o -user owner3 \) -print0 | tar --null -T - -cf -' | tar -xvf - You'd better review the tar archive content before extracting it. Replace last | tar -xvf - to | tar -tvf - and run to get the file list.


2

Not sure whether there is shorter command/method to do it, but this will work: for i in * ; do [[ $(stat -c %U ./"$i") =~ owner1|owner3 ]] && scp -p login@some.cluster.nl:/path/to/folder/ ./"$i" ; done It uses the stat -c %U on all the files in the current directory to check their owners and proceeds to scp the file if the owner is owner1 or ...



Top 50 recent answers are included