瀏覽模式: 普通 | 列表

怎麼在ssh console底下刪除特殊字元的檔案

比方說不小心產生了一個檔案名為 '-file',它多了一個字元 - (dash,在鍵盤數字 0 的右邊)

當我要刪除它執行了
rm -file
這個 - 會被認為是 rm 的參數之一而無法刪除成功
就算是
rm '-file'
也是如此

這時後可以再多兩個 --就可以成功刪除了
# 說明: rm(空隔)--(空隔)-file
rm -- -file
標籤: ssh

SSH 使用技巧 - 縮短名稱

網址 url 名稱能縮短,ssh 登入主機的名稱也可以縮短

一般我們會在 hosts 裡加入 1.1.1.1 ssorc

這樣子可以在 ssh root@1.1.1.1 時,換成 ssh root@ssorc 也是可以達相同效果

再不然也可以編輯 .ssh/config 加入
Host cross
        HostName ssorc.tw
        User root

就可以 ssh cross 登入至主機了

標籤: ssh

sudo 讓一般使用者有 Root 權限 (Part II)

http://ssorc.tw/rewrite.php/read-159.html

目的:

我想讓別人可以 SSH 使用一個我開給他的帳號 cross2 登入主機操作處理事情,但這個帳號 cross2 能夠有 root 權限,並我能夠記錄這個帳號 cross2 作了那些事情,且能禁止這個帳號 cross2 不能執行那些指令。

然後不能讓這個帳號 cross2 可以 sudo -s 、sudo su 、sudo bash 來切換成 root 環境,如果讓它切換成 root 環境就不會有 sudo  的記錄了。

1.) 編輯

visudo
Defaults        syslog=auth

# 概念大致是先 ALL 來允許全部,再一個一個用 ! 來設定你要禁止的然令

[閱讀全文]

標籤: ssh

SSH Client 端工具 Xshell

用過 putty,再來則是 pietty,最近在 try try 一個 xshell,它 for 個人是免費的

attachments/200804/3549469636.png
標籤: ssh

SSH + Received signal 15 terminating

在 /var/log/secure 中出現 Received signal 15; terminating
這會是讓主機非自願重開機的相關重要訊息嗎 ???

Quote: http://www.derkeiler.com/Newsgroups/comp.security.ssh/2002-10/2555.html
Someone sent sshd a SIGTERM, probably using the kill command. Seriously,
SIGTERMs aren't sent "implicitly" (unlike e.g. SIGBUS or SIGSEGV) -
someone sent it intentionally. E.g. running a RedHat rc script with
argument "restart" is likely to do this, instead of the more sensible
SIGHUP.

結果 - 2008/02/16 added
是 power 出了問題,換一顆了

標籤: ssh

ssh 搭配 expect 讓登入時可以自動化

一般我們使用 ssh 登入 linux 不外乎要輸入密碼,不用密碼的話就是 public key 了,
但如果不用以上兩種方式的話,就利用 expect 作互動方式,
有個參考範例如下
Quote: http://bash.cyberciti.biz/security/sshlogin.exp.php
#!/usr/bin/expect -f
# Expect script to supply root/admin password for remote ssh server
# and execute command.
# This script needs three argument to(s) connect to remote server:
# password = Password of remote UNIX server, for root user.
# ipaddr = IP Addreess of remote UNIX server, no hostname
# scriptname = Path to remote script which will execute on remote server
# For example:
#  ./sshlogin.exp password 192.168.1.11 who
# ------------------------------------------------------------------------
# Copyright (c) 2004 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)

[閱讀全文]

標籤: ssh expect 自動化

防暴力攻擊(Brute Force attacks) -- fail2ban

http://www.howtoforge.com/fail2ban_debian_etch的說明,fail2ban是一個防止暴力攻擊的程式,
且並不像 denyhosts只用於 ssh,它還可以針對任何有作記錄的 Service去設定,並使用 iptables來阻擋。

並參考: http://cha.homeip.net/blog/archives/2007/06/_fail2ban_ip.html

Fedora Core release 6 (Zod)

[1.] 安裝
         yum install fail2ban

[2.] 設定
         vi /etc/fail2ban/fail2ban.conf

# 設定 log 等級 及 路徑

[閱讀全文]