簡單概述Ubuntu命令系統
Ubuntu命令經一段時間的發展,我發表一下對Ubuntu命令個人見解,下面就這就來講術Ubuntu命令。如何限制通過SSH Ubuntu命令遠程連接的用戶帳號。
Ubuntu命令,假如你啟用了SSH服務,那么任何有有效帳號的用戶都可以遠程連接。這可能會導致一些安全問題,由于有一些遠程密碼破解工具可以嘗試常見的用戶名/密碼備份SSH服務的配置文件sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIGINAL
編輯配置文件
sudo gedit /etc/ssh/sshd_config
將參數 PermitRootLogin 由 yes 更改為 no。 超級用戶不能直接通過遠程聯機。
添加參數 AllowUsers 設定遠程連接的用戶名 (用空格來分割) 。
您也可以使用 DenyUsers for fine-grained selection of users.
If you enable the openssh server and you have no intention for now to enable remote connections, you may add AllowUsers nosuchuserhere to disable anyone connecting.
SSH Ubuntu命令
ssh Ubuntu命令可以用來在遠程機器上不經 shell 提示登錄而執行Ubuntu命令。它的語法格式是: ssh hostname command。譬如,如果你想在遠程主機 penguin.example.net 上執行 ls /usr/share/doc Ubuntu命令,在 shell 提示下鍵入下面的Ubuntu命令:
ssh penguin.example.net ls /usr/share/doc
使用 scp Ubuntu命令
scp Ubuntu命令可以用來通過安全、加密的連接在機器間傳輸文件。它與 rcp 相似。
把本地文件傳輸給遠程系統的一般語法是:
scp localfile username@tohostname:/newfilename
localfile 指定源文件,username@tohostname:/newfilename 指定目標文件。要把本地文件 shadowman 傳送到你在 penguin.example.net 上的賬號內,在 shell 提示下鍵入(把 username 替換成你的用戶名):
scp shadowman username@penguin.example.net:/home/username
這會把本地文件 shadowman 傳輸給 penguin.example.net 上的 /home/username/shadowman 文件。
把遠程文件傳輸給本地系統的一般語法是:
scp username@tohostname:/remotefile /newlocalfile
remotefile 指定源文件,newlocalfile 指定目標文件。
源文件可以由多個文件組成。譬如,要把目錄 /downloads 的內容傳輸到遠程機器 penguin.example.net 上現存的 uploads 目錄,在 shell 提示下鍵入下列Ubuntu命令:
scp /downloads/* username@penguin.example.net:/uploads/
使用 sftp Ubuntu命令
sftp 工具可以用來打開一次安全互動的 FTP 會話。它與 ftp 相似,只不過,它使用安全、加密的連接。它的一般語法是:sftp username@hostname.com。一旦通過 驗證,你可以使用一組和使用 FTP 相似的Ubuntu命令。請參閱 sftp 的說明書頁(man).
【編輯推薦】