Red Hat Linux Essentials Unit 14 - Network Clients

 

學習目標 

 

GUI Web Browser : Firefox

Non-GUI web browsers

elinks rpm 套件提供

links http://tw.yahoo.com

links -dump http://tw.yahoo.com (列出文字連結)

links -source http://tw.yahoo.com (列出原始碼)

 

Wget

支援 http and ftp,可應用於 shell script,用於 mirror web and FTP sites

wget http://www.redhat.com/training/index.html

help 文件:wget --help、info wget

 

圖形介面收發郵件: Evolution、Thunderbird、Kmail

文字介面收發郵件: mutt、mail

即時聊天:Gaim,支援多種IM

 

OpenSSH: Secure Remote Shell

比 telne 更安全的遠端登入

ssh [user@]hostname

ssh [user@]hostname command

$ ssh hork 'df -h'

 

scp: Secure File Transfer

比 rcp 更安全的遠端 copy

scp source destination

source 以及 destination 表示法:[user@]host:/path/to/file

-r,to enable recursion (啟用遞迴拷貝)

-p,to preserve times and permissions (保留原來的時間,權限)

-C,to compress datastream (傳送時資料壓縮)

 

rsync:Efficient File Sync

比 scp 更強大的遠端 copy

rsync *.conf barney:/home/joe/configs/

-e,ex: -e ssh

-a,啟用遞迴,並保留檔案權限

-r,啟用遞迴

-v,顯示傳送檔案過程資訊

-l,copy symlinks as symlinks

-R,使用相對路徑

$ rsync -R foo/bar/foo.c remote:/tmp/ (/tmp/foo/bar/foo.c)

$ /usr/bin/rsync -avlR --delete htdocs/ /f825/dir/ ( mirror 整個目錄,/f825/dir/htdocs)

參考:mirror、備份、資料轉移好用的指令 - rsync

 

FTP Clients

CLI: lftp

$ lftp ftp.example.com

$ lftp -u joe ftp.example.com

$ lftpget ftp://ftp.example.com.tw/pub/file.txt

GUI: gFTP

 

smbclient

存取 SMB/CIFS 檔案系統,俗稱網路芳鄰

smbclient -L server1 (列出server提供的資源)

smbclient  //server1/homes (無密碼連線)

smbclient -U student //server1/homes (有密碼連結)

smb: \> (ls、cd、get、put)

參考 Linux 各種 mount 整理

 

Xorg clients

可以把遠端介面的 GUI 軟體開在本地端,兩端都要有 X-Wndow

ssh -X user@host xterm &

Network Diagnostic Tools

 

Lab 14 重點

# ping -c 100 ptt.cc

# lftp 192.168.1.1

lftp 192.168.1.1:~> user

使用方法: user 用戶名稱 [密碼]

lftp 192.168.1.1:~> user username password

lftp username@192.168.1.1:~>

(ls,get,put,by)

 

# ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

4a:28:94:1f:93:f3:cd:de:d9:20:04:2f:86:0d:61:51 root@localhost.localdomain

# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.1.1

root@192.168.1.1's password:

# ssh 192.168.1.1

Last login: Fri Jun 29 14:11:07 2007 from mail.vblog.tw

[root@localhost ~]#  ← 登入成功

 

(private key 加密)

# ssh-keygen -f .ssh/id_rsa -p

Key has comment '.ssh/id_rsa'

Enter new passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved with the new passphrase.

# ssh 192.168.1.1

Enter passphrase for key '/root/.ssh/id_rsa':  ← 需要輸入密碼

Last login: Fri Jun 29 14:12:01 2007 from mail.vblog.tw

[root@localhost ~]# ← 登入成功

[root@localhost ~]# exit

Connection to 192.168.1.1 closed.

[root@localhost ~]#

[root@localhost ~]# ssh-agent bash

[root@localhost ~]# ssh-add

Enter passphrase for /root/.ssh/id_rsa:

Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)

[root@localhost ~]# ssh 192.168.1.1 w ← 不需要再輸竹密碼

 14:24:02 up 52 days, 23:48,  1 user,  load average: 0.00, 0.00, 0.00

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

root     pts/0    140.123.23.21    10:43   14:00   0.19s  0.13s

 

 

 

 

 

 

 

 

 

by SmallKen