Solved

ssh & scp

Posted on 2004-04-15
14
1,263 Views
Last Modified: 2012-06-27
Just basic questions...

If I wanted to ssh into another machine from my linux box using bash shell, how would I do that (i.e. what would be the command)?

Also, if I have a large .tgz file in my linux box and want to transfer it to another machine using scp, what would be the command using bash shell?   Can I only use bash shell to unzip this .tgz file?   I want to work in the windows environment, do I need to unzip it first and send what's inside?

Finally, when logging from or transfering files from linux, are there any other good (convenient way) of doing it besides using ssh and scp?

I'd appreciate any comments on these questions.
0
Comment
Question by:skyblue01
  • 5
  • 5
  • 3
  • +1
14 Comments
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10838497
Creating an ssh session:

    ssh skyblue01@someothersystem.com

(You will be prompted to accept the connection, and keep the host id locally; then you will have to enter your password.)

Moving a file from your system to the other system with scp:

    scp big.tgz skyblue01@someothersystem.com:big.tgz

On Windows, if you want to do gunzip and tar reliably, you can use a program such as Aladdin stuffit expander: I think it knows both gunzip and tar: http://www.stuffit.com/win/expander/index.html

What I do on Windows, though, is install Cygwin (http://www.cygwin.com/) which will get you bash, gunzip, tar, ssh, and scp on your Windows system. I've always used it on Windows 2000 and Windows XP -- can't say how solid it is under Windows 95/98, etc., but it probably works fine.

If you want to be secure, the best thing is to use scp

0
 

Author Comment

by:skyblue01
ID: 10840267
Thanks john-at-7fff.

For ssh:
In
ssh skyblue01@someothersystem.com, can I have an ip address of the remote machine after @ instead of a the name of the machine someothersystem.com?

Also, is it possible to ssh or do a remote login into a windows machine?   I tried to do that from my linux box and the connection timed out on port22(ssh).   If not, is there a way to do it?

For scp:
If you transfer file from linux to windows, and type something like:
scp big.tgz skyblue01@someothersystem.com:big.tgz
where would this file be going (i.e. in which directory)?
I know that you can do it both ways using apps like winscp but I just wanted to know how to do it from my linux box.
0
 
LVL 8

Assisted Solution

by:da99rmd
da99rmd earned 150 total points
ID: 10840611
You must start a ssh server on the windows side like this one
http://www.bitvise.com/download-area.html

/Rob
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 2

Assisted Solution

by:j_dyer
j_dyer earned 50 total points
ID: 10841037
>In ssh skyblue01@someothersystem.com, can I have an ip address of the remote machine after @ instead of a the
>name of the machine someothersystem.com?

Yes, you can use the IP address instead of the hostname.
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10841061
>If you transfer file from linux to windows, and type something like:
>scp big.tgz skyblue01@someothersystem.com:big.tgz
>where would this file be going (i.e. in which directory)?

It works but the location depends on the configuration of the ssh server you install on the windows side but i think the file will end up in your home dir.

/Rob
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10841129
0
 
LVL 4

Accepted Solution

by:
john-at-7fff earned 300 total points
ID: 10841233
skyblue01:

Do you want to start the file transfer from your Linux machine, or from your Windows machine? I.e., which machine is going to initiate the transfer --

Because:

If you want, you don't have to install a ssh server on Windows if you have an sshe server running on Linux.

The reason is that if you install cygwin, and have ssh and scp running on Windows, you can just start a DOS box on Windows, start bash, and then run scp on Windows.

When you run scp on Windows, you can make the transfer go in either direction: From Linux to Windows or from Windows to Linux.

For example: Say the IP for your Linux box is 192.168.1.101

From your Windows system, to move the file from Linux to the current directory:

scp skyblue01@192.168.1.101:big.tgz big.tgz

From your Windows system, to move the file from your current dir on Windows to the Linux machine:

scp  big.tgz skyblue01@192.168.1.101:big.tgz

0
 

Author Comment

by:skyblue01
ID: 10851496
>The reason is that if you install cygwin, and have ssh and scp running on Windows, you can just start a DOS box on >Windows, start bash, and then run scp on Windows.

Since when using scp on windows, you'll be accessing the linux box (if transfer from windows to linux) wouldn't you need to have a username and a password?   How can you set that up?
0
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10851503
Can you log in at all on your Linux machine?
0
 

Author Comment

by:skyblue01
ID: 10851546
>Can you log in at all on your Linux machine?

What do you mean by that?   Login remotely?   I don't think I can and that's what I want to know -- how to allow others to access the linux machine (like assigning them username and password)...
0
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10851574
You have to be able to login as someone -- say, the root user -- in order to create a user on Linux.

That's what I'm asking: Do you have root?

Also, if you *do* have root, you may be able to scp in as root, and you wouldn't have to create a user.
0
 

Author Comment

by:skyblue01
ID: 10851597
Oh so that's what I'm gonna be using...   If I have root, I should be able to use that or as any other user to login, am I correct?
0
 

Author Comment

by:skyblue01
ID: 10851613
Thanks all for your suggestions.
0
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10851633
Well, if you can do scp as root, that's great. Remember that after installing cygwin, so you can run ssh and scp from your Windows box, I said the command should be:

    scp big.tgz skyblue01@someothersystem.com:big.tgz

If you log in as root to the Linux system, it would be:

    scp big.tgz root@someothersystem.com:big.tgz

It is possible that your system is configured to disallow ssh and scp as the root user.

if so, then you would need to create a new user with the useradd command. After logging is as root on the Linux system, do: man useradd to learn all about it. You could create a user called skyblue01 and then the scp command would be the original idea:

    scp big.tgz skyblue01@someothersystem.com:big.tgz

One last thing. If this is a linux system on your LAN, you might want to use it's raw IP address (if you know it). Something like:

    scp big.tgz skyblue01@192.168.1.100:big.tgz

Good luck!
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question