Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How do you copy files from local linux computer to amazon aws linux instance?
We can do that through scp command shown below:
scp -i testkey1.pem sourcefile ec2-user#ec2-51-122-239-158.us-west-2.compute.amazonaws.com:outputfile
or if you want to copy a complete directory
scp -i testkey1.pem -r sourcefolder/ ec2-user#51.122.444.128:~/
-i is the option for pem file
ec2-51-122-239-158.us-west-2.compute.amazonaws.com is the public dns
address, You can get this value from aws console of your instance.
If you are looking for a GUI approach you can use SFTP. Many programs like Transmit for Mac or Filezilla can connect to your instance through SSH by connecting to the public DNS name (found in AWS console).
If you want you can definitely use SCP and it is very reliable as you suggested.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
How to copy a file located locally in my folder, while being connected in SSH?
This command works perfectly, but only when I run it locally:
scp /home/josh/Desktop/DATA/import/file001.csv root#10.0.3.14:/var/www/html/project
I would like to have the same result in launching it by being connected in ssh, is it possible?
You can setup ControlMaster in your .ssh/config
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
Then use ssh command mode which will reuse existing connection:
Solution with push ssh session into background:
local$ ssh remote
remote$ ~^Z # Shift+`, Ctrl+z - Push ssh into background
local$ scp file remote:/remotepath
local$ fg
remote$
You can also to open tunnel via:
remote$ ~C # Shift+`, Shift+c - Enter command mode
ssh> -R15000:localhost:22 # tunnel to local:22 from remote:15000
Forwarding port.
remote$ scp -P15000 localhost:/filepath ~/
remote$ ~C
ssh> -KR15000
Canceled forwarding.
remote$
STEP 1 : Get the ip address
hostname -I
STEP 2 : Call SCP into SSH
scp josh#my_ip_address:~/Desktop/DATA/import/file001.csv /var/www/html/project
ie: "josh" is my name for the connection into my PC
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
In order to log into a dedicated server via SSH, i use the following command:
ssh -p 49276 myusername:1001#server.address.net.com
The :1001 after the username is required for me to log in.
I'm now trying to scp some files from this server, using the following command:
scp -P 49276 myusername:1001#server.address.net.com:/var/www /localfolder
But when I do that, I get an error:
Could not resolve hostname myusername: nodename nor servname provided, or not known
I assume it's because of that colon after my username. How would I SCP using these credentials?
This is simply a feature of the Cisso ssh server implementation; it
parses the user name, and if it contains a :[0-9]+ component then it
understands it has to connect the session to the console port with the
corresponding number.
From here https://unix.stackexchange.com/questions/187658/integer-after-username-in-openssh-client-separated-by-colon
Try this:
scp -P 49276 -o User=myusername:1001 server.address.net.com:/var/www /localfolder
This might be a convoluted method, but I believe it will work for your case.
You can define hosts in your ~/.ssh/config file. There you can specify a username to use for a specific hostname. For example -
Host myhostname
User myusername:1001
HostName myhostname.com
Port 49276
With this in your ~/.ssh/config file, you'll be able to use an scp command similar to this -
scp myhostname:/var/www /localfolder
The host will be used together with the specified user and ports in the config file.
A pretty old link, but still useful info on ssh config files:
http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have a script.sh stored on remote server at some directory, which I want to run from a local computer.
How can I do that in unix using ssh?
You can use ssh command from the local server to execute commands on the remote server. You just have to do something like this:
ssh [user]#[server] '[command]'
In your case, you are trying to execute a shell-script. You can use the same method in the following way:
ssh [user]#[server] /location/of/your/script.sh
You can also run multiple commands in this way:
ssh [user]#[server] '[command 1]; [command 2]; [command 3]'
Or you can also do something like this:
ssh [user]#[server] << EOF
command 1
command 2
command 3
EOF
I assume you have ssh access to your remote server. Type this in a terminal at the local server:
ssh user#remote-server /path/to/script.sh
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How to copy files into different directory in a remote machine?
For Example:
My server : 10.10.0.1
Remote Server : 10.10.0.2
I have to login to 10.10.0.1 (through Putty). From here, I have to copy a file in remote machine from /home/test/myFile.txt to /home/bkp/myFile.txt.
Both source and destination folders are in remote machine.
Assuming you can ssh to 10.10.22.12 as "username" and "username" has write permissions to /home/testBkp:
scp /home/test/sample.txt username#10.10.22.12:/home/testBkp/sample.txt
Use scp. For example:
scp file_to_copy user#server:/home/user/foldername/filename.ext
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have public ssh key created on Windows 7 and I want to install it on remote Debian. How to do it?
This question here is off-topic and will probably be moved to http://serverfault.com.
However, copy your public key to the remote debian system with scp (I don't have a Windows machine, so I will give you Linux instruction, try to understand them and modify them according to your operative system):
scp /path/to/public/key.pub user#debian-server:~/.ssh/key.pub
It will ask your password to log in, then it will copy the key and log out.
Log in again in your machine with ssh and do the following:
ssh user#debian-server
chmod 700 .ssh
cd .ssh
cat key.pub >> authorized_keys
chmod 600 authorized_keys
exit
Now, you should be able to log in remotely without issuing your password, providing that RSA authentication method is enabled in sshd_config on the debian server.
Note: the chmod part is not worldwide required, but sometimes wrong permission on files and folder will prevent you to correctly login.
You have to store your public key into .ssh/authorized_keys on your debian machine.
You will find the .ssh folder in your home directory if openssh-server is installed.