Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm a university student, and very new to ssh and scp... and new to programming. The newest assignment given to us requires accessing libraries that are only on the student server at university. To work at home, they said to use SSH.

So I've done that, and I can use ssh to log on to the student server, so that I can compile using the libraries stored there (C++ programming)

However, I'm not sure how to do either:

  • compile the files on my local computer in the student log-in terminal. OR
  • use scp to copy the files I'm working on to my @student folder, so that I can then compile while logged in.

with regards to b) I've tried the following command:

scp mike@ubuntu: /a1644923/testscp a1644923@uss.cs.adelaide.edu.au: a1644923

but then I get:

ssh: connect to host ubuntu port 22: Connection refused
cp: cannot stat `/a1644923/testscp': No such file or directory
a1644923@uss.cs.adelaide.edu.au's password:
share|improve this question

3 Answers 3

up vote 1 down vote accepted

The sensible thing to do is to copy the files from your home computer to the student server. (What you tried in the second step)

scp requires two parameters: source and destination, and only the remote part needs username@hostname.

So your command (for one file for testing) should read:

scp a1644923/testscp a1644923@uss.cs.adelaide.edu.au:

The colon at the end is important. Make sure to have no extra blanks in the command. I assume the directory a1644923 is in your current directory. You can copy/paste that command into your shell.

If you need to transfer a complete directory instead you must enable recursive mode. I am assuming you have a directory project1 in your current directory. So type

scp -r project1/ a1644923@uss.cs.adelaide.edu.au:

Mind the blank between scp and -r. The command is scp and -r is a parameter, telling scp to work recursively, i.e. to copy everything below.

share|improve this answer

Hello Mike do it like this:

sudo apt-get install sshfs

sshfs username@server:/home/UsersHomeFolderAtServer mnt/

in your local home directory create the folder mnt then mount your home folder from the server to your local machine. You can then work with your files locally but there are uploaded to the server when you make changes.

i would recommend to compile the files on the server because it may have diffrent library/package version installed than you have on your local machine.

share|improve this answer

The error is telling you that it cannot find the file at the location you specified (stat is a function to test a file for existence, among other things).

Assuming that the file is in a directory /a1644923/testscp on the remote machine, your problem seems to be the spaces after the colons; they should not be there. Generally, if you have a space in a filename, you need to escape it with '\ ', or use quotes. Otherwise, it's interpreted as separate parameters.

scp is really not any more complicated than cp, except it copies from one machine to another. But it has a very similar syntax, just the file specification format needs an extra specifier for the machine, if it's different than yours (you don't need to specify your own machine).

Edit:

From what you stated about the libraries being on the remote computer and all, it seems like you want to compile the sourcefiles on the remote computer to use those libraries. It sounds to me like everything is expected to be done on the remote computer, so your local computer is basically just a remote terminal.

When I was in a similar situation, I used the same tools remotely as locally (gvim for editing, and other standard Linux tools. So working remotely was the same as working locally, more or less, and there was no problem remembering to copy files that were changed, or accidentally overwriting new files with old ones.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.