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
Hello guys...
I have a script running every night on a linux server, which intend to get files from another one using wget and ftp protocol. These files are located under a folder that can't be accessed through HTTP.
Here's the command line used :
wget --directory-prefix=localFolder ftp://login:password#adress.ip.of.server/path/*
The site access has been changed to SFTP. I would like to modify the script to be able to get the files just as it was doing before, but don't manage to do this with SFTP.
I tried to generate a secure key using ssh-keygen and then copy it to the server I wanted to access, but it didn't make it, or I just don't succeed to find the right way to do it...
Thanks ahead for your help ! :)
To copy keys, I find that ssh-copy-id user#machine does all you need. As long as you have a key on your machine that is.
I also use scp quite a bit, where you specify scp user#machine:filespec whereto (it is using the same encryption and authentication mechanism as sftp).
Hope this helps.
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 6 years ago.
Improve this question
I'm new to using bash commands and having some trouble. I'm ssh'ing into a linux box which contains some of my work files. I have a local file on my mac which I need to copy onto the server.
Here are the steps I've gone through so far:
1) ssh usrname#orgname.edu
2) Entered password
3) pwd
4) working directory: home/usrname
I'm stuck after this. I have a local folder in documents in my mac. I want to copy it to my working directory on the server I"m ssh'ed into.
Appreciate your help. Thanks
When you ssh to a remote machine, then it's as if you are sitting in front of that other machine and execute commands in it. While you are in that state, you cannot copy file to (or from) it. Instead you have to use a different tool, scp, which also belongs in the ssh family and in fact calls ssh behind the scenes. This is how you copy a local directory to a remote machine:
scp -rp /path/to/local/dir usrname#orgname.edu:/path/to/remote/dir
I used the -r mode (which stands for recursive) to copy the directory recursively. See also the manual of scp for more details
You will want to use sftpinstead of ssh for this. Try the following:
sftp usrname#orgname.edu
Enter password
cd <directory where you want to transfer the file>
put <name of file you want to transfer>
You can also add 'l' before some commands to indicate that you want to do that locally. i.e. ls will display files on the remote server, and lls will display files on the local machine.
EDIT :
You will want to make sure that you either
a. navigate to the folder that contains the file you want to transfer prior to starting the sftp process.
b. use lcd and lls once you are in the sftp session to navigate to the local folder that contains the file you want to transfer.
As mentioned in the comments, using the full path to the file you want to transfer doesn't work.
From your Linux command prompt: scp -C -r username#remote.host:/path/to/remote/directory/ target/directory
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 7 years ago.
Improve this question
In putty i want to copy a .war file from my machine (at D:\\file.war) to a remote server like this:
sudo scp -r D://file.war user#xxx.xxx.xxx.xxx:/tomcat8/webapps
it doesn`t work and i have also tried things like:
sudo scp -r \file.war user#xxx.xxx.xxx.xxx:/tomcat8/webapps
or
sudo scp -r /cygdrive/d/file.war user#xxx.xxx.xxx.xxx:/tomcat8/webapps
I have to type in my password two times then (one time for sudo, next time for user). But then i get always the same error:
<pathtolocalfile>: No such file or directory
Putty always connects via SSH. I need sudo to get permission to write into the webapps folder.
How do i have to specify the path? Sry, i´m trying this for the first time and after some research i´m getting more and more confused about how to do this the right way.
I managed to do what i wanted, although my solution is not the nicest:
I connected to the server using WinSCP and my normal user account.
There i copied the file into my user home directory.
Then i opened the Putty console in WinSCP and changed to root user with "sudo" (and typing in my password again).
Now i finally was able to copy the file from my user accounts home directory into the webapps folder of tomcat.
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 like to ask how am I going to copy files from one of my Linux Server Account to other account? If anyone knows how, please help me.
Take a look at the man pages for scp. This is a very useful command that I use rather often at my job.
It works easiest if you are logged into the server that has the file you want to transfer (IMO). The syntax is scp src_file username#remote_host:dst_file, where the text that comes after the : in the second part is the destination path on the other server.
For example, if you have a file called "file.txt" on server1, and you want to put it on server2, you would type:
scp file.txt username#server2.name.or.ip:/home/other_username
or where ever you want to put the file. I would recommend copying the file first to your home directory on the other server as that minimizes issues with permissions, in my experience.
EDIT: If you want to log into the server that is going to receive the file, you can just swap the first and second arguments to copy from the remote server to the local one.
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 am afraid my question could be very stupid, and also be duplicate. But I didn't manage to find what I want after looking for some similar questions on this site.
My question is simple, I have a big file, i.e. 1GB on my Ubuntu server, and I want to share this file with other users. How can I create a URL address for public users, in other words, when one user click this URL, the download will automatically start without demanding a username and password, just like we download many stuff (pdf, music) when we find an usable url with google.
Someone suggests me to setup an anonymous ftp. I think it's a possible solution, but I didn't succeed to accomplish it. Can some one give me more details how I achieve my goal, (with or without ftp will both ok).
Thanks for any help, and I am very grateful for some examples, or some tutorials !
Install Apache2
sudo apt-get install apache2
Place your into file the /var/www/ directory (might need root privileges for this)
sudo cp yourfile /var/www/yourfile
Access the file with the following link:
http://your-ip-address/yourfile
If your running under a router or firewall, you might have to open port 80 and forward it to your pc.
Lets assume your filename is foobar.iso.
You could just place it in your web root, and give the link example.com/foobar.iso to people. This will download the file.
Optionally, place it in a directory downloads. The download link will then be example.com/downloads/foobar.iso.
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'm using CentOS 5.5 and I'm trying to remotely modify file of an OpenVMS server. I tried with scp but I got an error about an "unexpected newline".
I tried to find the solution to this but I haven't found it yet.
Then I tried with sftp and I succeded but only in my openvms home directory. I don't know how to reach other folders.
For example :
vim sftp://myLogin#myServer//sys\$user/myLogin/test.txt
will successfully open the file test.txt in my openvms home directory.
What I would like to achieve is to modify the file test.txt in this directory for example : OpenVMSHomeDirectory.xxx.yyy
Does anybody know a way to do this ? I fail to find how to reach my file to edit it.
Thank you.
The OpenSSH sftp client that you are probably using supports the quite Unix centric version 3 of the protocol. Try with a client supporting a later version as lftp, WinSCP or FileZilla.
If I recall correctly, OpenVMS SFTP server converts the VMS file paths into some more Unix friendly format (i.e. using / as the directory separator) when talking to a v3 client.