open Webmail 簡易轉址
=====================================
<html><meta http-equiv="refresh" content="0; url=/cgi-bin/openwebmail/openwebmail.pl"><body>Loading OpenWebMail&#8230;</body></html>
=====================================
將以上的虛線內的 html 碼 ,存成 index.html 即可使用。

如何修改 root pw

1.在 linux 開機時進入 rescue
2.#fdisk -l
3.#mkdir aa
4.#mount /dev/hda2 /aa
[找最大的那一塊,即 root →/,mount 進來]
[這裡通常都是靠經驗來找!]
4.#chroot /aa
5.#passwd
6.修改密碼囉!

[分享]如何使用 Pietty/Putty 做 Client Port Forward?

概念:
在公司內部的電腦 < -> 公司防火牆(ISA Proxy) < -> 有真實 IP 電腦 < -> 內部的電腦

在這中間利用 Pietty/Putty 來建立 Tunnel,注意要用 Key 授權的方式來
登入 SSHD Server 喔,不然會有被 TRY 站的危機喔!但用 Key 也會被 Try 站,
但是,被 Try 成功的機率會比較小,會安全很多。

0.準備 Pietty
下載: http://ntu.csie.org/~piaip/pietty/stable/pietty0327.exe
和一台有真實 IP 的 Linux 主機,並有開放 443 Port 的 SSHD Server.

Linux 主機的設定我粗略的說一下,因為這個不是本篇文件的教學重點,
#vi /etc/ssh/sshd_config
加入
Port 443
#存檔離開
#service sshd restart
只要用 Pietty 走 443 Port 能連上你的 Linux 主機,
那麼本次教學您就能繼續下去囉!另外 Pietty 有支援 http proxy,
所以可以用 http proxy 連線喔!
另外,要讓 Pietty 不會被 ISA PROXY 給切斷連線
,請看 Port_Forward_5.jpg 藍框的部份勾選及設定即可。

最後連線時,請連 127.0.0.1 就可以囉.

1-1.Connection -> SSH -> X11 (For Linux Server VNC use)
1-2.將下圖所框選的打勾,並輸入 0 即可。
PS.這個步驟遠端是 windows 的可以不用做,這個是針對 Xwindow 的 VNC 遙控設定。

2-1.L5900: 選擇 Local, Source Port:輸入 5900
2-2.192.168.1.11:5900: 在 Destination 的地方輸入 192.168.1.11:5900 即可
(192.168.1.11 是你要連內部的那台電腦的 IP,5900 是那台電腦的 Port 號)
3.按一下 Add 喔.

3.最後完成必須有 L5900 的設定即可。(R5900 不用設定)
不管公司怎麼擋,只要你有上網權限(有開放 443 PORT),你就能完成如 VNC 遠端遙控的工作囉。
不過要是遇上了 layer-7 的防火牆,還是一樣沒法子通過。

4.請依藍框的部份,勾選及輸入設定即可。

5.最後開啟 VNC Viewer 進行連線時,請輸入 localhost 就可以連線了。

6.新增加一個對外連線的埠口,可以直接對應對外的 proxy 的主機。
在此的範例是為 L88 → proxy.hinet.net:80
就可以轉出去了,不用在同一台主機上架一台 proxy 了。
(R88 → proxy.hinet.net:80 < -- 可以不用設。)

#vim /etc/profile

到檔案的結尾,插入下列的字樣即可。


NOW=`date +%Y-%m-%d:%H-%M-%S`
LAST=`last $USER -5`
echo "Login Time:[$NOW],Login User is $USER ,From: $HOSTNAME …" > /tmp/userlogin.log
echo "$LAST" >> /tmp/userlogin.log
mail -s "Attention !! root User Login~" spl...@cpalm.org < /tmp/userlogin.log
rm -f /tmp/userlogin.log


只要將上述 email -> spl...@cpalm.org 改成您要收到通知的 Email 即可。

域名自訂更換成功!!

哈哈哈哈…..

哈,搞了 2 天終於把 自已在 blogspot.com 的域名更換為 blog.splin.org 了。 ya~

不過為什麼很簡單的 DNS 設定要搞了 2 天才弄好,就因為自已的不小心
把 named 裡頭的語法 CNAME 打成了 CANME,導致 named 一直認不出
什麼是 CANME,哈~ 大烏龍~

來教學一下,
先到 Dynadot 購買自已想要的域名 , 再就是設定 DNS 。
我自已是有架設 DNS SERVER 所以,先講設定 指向 GOOGLE 的寫法:

blog.splin.org. IN CNAME ghs.google.com.

這樣子就可以存檔並重新啟動 named 的服務。
另外如果自已沒有架 DNS SERVER 怎麼辦?
Dynadot 有提供類似的服務,
貼個圖片給各位看看,這我沒用過,有問題的話就自行請教 DNS 的服務提供者吧。

再來就是回到 www2.blogger.com 進行自訂域名的填寫:


點上圖的 自訂網域 切換到下圖進行自訂域名的填寫:


在 "您的網域" 填入 "blog.splin.org" 這樣的域名就可以。
(PS.寫你自已的,不要寫我的 XD )

最後點一下 "儲存設定" 就可以囉~
教學完畢!

有些人也想說,我也想替我的使用者也提供類似的服務,
不要再用密碼登入系統,想要用 Key 來登入,但是,
因為目前密碼的服務,可能已經關閉了,怎麼辦?

====[User篇---開始]===================
0.修改 sshd 的組態檔
/etc/ssh/sshd_config 要修改一行的內容
找到 AuthorizedKeysFile .ssh/authorized_keys
改成 AuthorizedKeysFile %h/.ssh/authorized_keys
存檔離開,並重新啟動 sshd 服務
#service sshd restart

1.建立 splin 這個使用者帳號,並修改密碼.
#useradd splin
#passwd splin
#cd /home/splin/
#mkdir .ssh
#cd .ssh
#ssh-keygen -b 2048 -t rsa
(#ssh-keygen -b 1024 -t dsa)
以下為 ssh-keygen 執行所會發問的問題:
Generating public/private dsa key pair.

當你用 root 登入時,執行 ssh-keygen 會出現下列顯示的路徑
Enter file in which to save the key (/root/.ssh/id_dsa) or (/root/.ssh/id_rsa):

當你用 splin 登入時,執行 ssh-keygen 會出現下列顯示的路徑
Enter file in which to save the key (/home/splin/.ssh/id_dsa) or (/home/splin/.ssh/id_rsa):

所以以上不管出現何種,如果出現的是預設的路徑 (/home/splin/.ssh/id_dsa) or (/home/splin/.ssh/id_rsa)就按 Enter 跳過,
則不用輸入→ /home/splin/.ssh/id_dsa or (/home/splin/.ssh/id_rsa) (要含路徑和檔名),以上跟你用那個 ID 登入系統有關係。

Enter passphrase (empty for no passphrase):
輸入要保護私鑰的密碼,這裡跟系統的密碼不用一樣,而且密碼千萬是不要一樣。

再來接下來和 Root 篇的公鑰內容導入至 authorized_keys
#cat id_rsa.pub > authorized_keys
(#cat id_dsa.pub > authorized_keys)
但是要確認在 /home/[users]/.ssh/ 路徑和檔名有沒有錯誤。
[users]→表示為 user 的帳號名稱。

2.把 server 上的私鑰:id_dsa (id_rsa)拷貝到 PC 上
將 id_dsa (id_rsa) 的內容顯示在螢幕上,再複製下來.
#cat id_rsa
(#cat id_dsa)
把複製的內容貼到記事本裡存成 id_dsa_by_ssh-keygen.ppk
(id_rsa_by_ssh-keygen.ppk)
(檔名命名方法沒有一定,但是為不讓自己搞不清楚,這樣子做最好)
再來就是開啟用 puttygen.exe → Conversions → Import Key
(匯入時,因為我們在用 ssh-keygen 產生公/私鑰時,就有用密碼了,所以在你使用 puttygen.exe,
做匯入的動作時,自然會要求你輸入密碼了)
匯入後,在 Key passphrase 和 Confirm passphrase 輸入保護私鑰的密碼後,
(不想打密碼的人,就保留成空白也可以,不過萬一私鑰掉了被撿到,那就慘了>"< ), 然後,再從 File → Save Private Key 把私鑰另存新檔即可使用了。 3.強烈建議:私鑰(Private Key)一定要用 Key Passphrase 來保護,
密碼(至少 8 個英數字以上並混合交錯,每三個月更換一次公/私鑰)千萬不要跟 root 的密碼一樣.

4.因為我是用 root 來替 splin 這個 user 建立公/私鑰
所以我要把檔案權限和屬性稍微修改一下。
#chown -R splin.splin /home/splin/.ssh/
#chmod -R 755 /home/splin/.ssh/

5.Pietty/Putty 使用方法:
啟動 Pietty/Putty ,從 SSH → Auth 去指定私鑰的檔案路徑即可。

====[User篇---結束]================
PS.
1.以上有任何看不懂的,歡迎在此發問,或來信詢問皆可。
2.在您用 putty 測試私鑰是否可以使用之前,請先不要把原先的連線直接關閉,
請先測試用私鑰可以登入後,再把停用密碼登入的選項設定由 yes 改成 no.

How to use Authorized Key by ssh for login?
如何使用公鑰/私鑰登入 Linux 系統?

====[Root篇---開始]===============================================
以下的 config 檔,為 FC4 的 /etc/ssh/sshd_config 的內容
————————————————————————————-

代碼: sshd_config
# $OpenBSD: sshd_config,v 1.70 2004/12/23 23:11:00 djm Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

Port 22
#Protocol 2,1
#Because Portocol 1 is not safe ,so I don’t use, and avoid attack.
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
MaxAuthTries 3

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don’t trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don’t read the user’s ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

# Set this to ‘yes’ to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression yes
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#ShowPatchLevel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server


————————————————————————————-
以上內容為 FC4 的 /etc/ssh/sshd_config 的內容,但僅供參考,我不敢保證完全對,
所以照抄不一定 OK,所以請依您系統的實際狀況及週遭的情況去調整。
===============================================
0.事前準備:
Puttygen.exe → http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe
Putty.exe → http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
Pietty.exe(建議使用,有支援中文輸入,SCP 檔案上傳.)
http://ntu.csie.org/~piaip/pietty/stable/pietty0327.exe
WinSCP3 → http://winscp.net/eng/
==============================================

1.修改 /etc/ssh/sshd_config

#在 sshd_config 裡,找到與下列相符的選項,就將選項前的 # 號拿掉:
Protocol 2
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PermitRootLogin yes
#找到 ChallengeResponseAuthentication yes 的選項,改成 no ,如下:
#(選項解釋:密碼登入選項,一定要改成 no,這樣子沒有擁有私鑰的人就會無法登入了)
# Change to no to disable s/key passwords
#修改成 no 來停用 s/key 密碼
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no
還有把 PasswordAuthentication yes
改成 PasswordAuthentication no

#以下為非必要選項
SyslogFacility AUTHPRIV(或 SyslogFacility AUTH)
LogLevel INFO

接下來就存檔離開
重新啟動 sshd 服務.
#service sshd restart

2.在 Server 端,使用 ssh-keygen 來建立 DSA Private Key 和 Public Key.
先檢查 /root 下有沒有 .ssh 的資料夾,如果有就略過建立資料夾的步驟:
在 /root 下建立資料夾 .ssh,
#mkdir .ssh
#cd .ssh
#ssh-keygen -b 2048 -t rsa
(#ssh-keygen -b 1024 -t dsa)
然後,輸入 Private Key(私鑰)檔名:id_rsa (id_dsa),和 Public Key(公鑰)檔名:id_rsa.pub (id_dsa.pub)
這個時候會問你 key passphrase,
(可以自由選擇輸入與否,即使現在不輸入也沒關係,
後面再用 puttygen.exe 轉換格式時再輸入,也是可以的,
但是不可為了省卻輸入密碼,而只用 KEY 就登入 LINUX 系統,
此舉很危險,萬一 Key 檔案被有心人士偷取,就糟糕了.>"< )

再來把公鑰的內容導入到 authorized_keys
#cat id_rsa.pub > authorized_keys
(#cat id_dsa.pub > authorized_keys)

3.因為 Openssh 的私鑰格式和 putty 使用的格式截然不同,
所以需要由 puttygen.exe 轉換格式後才能使用,不然可能會有兩種錯誤的情況:
———————–

—————————————
可能出現的幾種問題:
(a)、Server refused our key
公鑰和私鑰不匹配,或者沒有 authorized_keys 文件
(b)、Unable to use key file "id_dsa.ppk"("id_rsa.ppk") (SSH2 private key)
私鑰檔案的格式不正確
————————————————————–
3.1把 server 上的私鑰:id_dsa 拷貝到 PC 上
將 id_rsa (id_dsa)的內容顯示在螢幕上,再複製下來.
#cat id_rsa
(#cat id_dsa)
把複製的內容貼到記事本裡存成 id_rsa_by_ssh-keygen.ppk(id_dsa_by_ssh-keygen.ppk)
再來就是開啟用 puttygen.exe → Conversions → Import Key
匯入後,在 Key passphrase 和 Confirm passphrase 輸入保護私鑰的密碼後,
(不想打密碼的人,就保留成空白也可以,不過萬一私鑰掉了被撿到,那就慘了>"< ), 然後,再從 File → Save Private Key 把私鑰另存新檔即可使用了。 4.Pietty/Putty 使用方法:
啟動 Pietty/Putty ,從 SSH → Auth 去指定私鑰的檔案路徑即可。

5.強烈建議:私鑰(Private Key)一定要用 Key Passphrase 來保護
密碼(至少 8 個英數字以上並混合交錯使用,每三個月更換一次公/私鑰)千萬不可與 root 的密碼相同.
另外,當你在 Server 上用 ssh-keygen 公/私鑰時,會詢問公/私鑰的檔名和
保護 KEY 用的 Passphrase 的密碼,在 Server 有輸入的話,在用 puttygen.exe
做轉換時也會叫你輸入,所以要小心輸入喔!
====[Root篇---結束]=========================
如果沒有 Linux Server 也可以用 SSH for Windows 喔!
官網: http://sshwindows.sourceforge.net/
下載連結: http://sshwindows.sourceforge.net/download/

文章頁次3/3
首頁 « 123

訂閱網站

Copyright 2007 マルクのブロッグ | Theme Sco v4.0 By:Scorpio

Page optimized by WP Minify WordPress Plugin