2018年6月27日 星期三
ssh使用key(pageant)登入失敗 : Server refused our key
使用PuTTYgen,Parameter選DSA,將Key貼到/home/user/.ssh/authorized_keys內存檔
PuTTY內設定 Connection --> SSH --> Auth --> Private key file for authentication選好了private key檔案
設定完,測試PuTTY連線,失敗!!!
視窗內出現 "Server refused our key"
透過Google很快查到是SSH daemon對於key的安全性有嚴格限制
1.server上儲存key的目錄必須是700
chmod 700 /home/user/.ssh
ls -la /home/user/.ssh確認一下: rwx------
2.authorized_keys這個檔案必須是600
chmod 600 /home/user/.ssh/authorized_keys
ls -la /home/user/.ssh/確認: rw-------
重新測試,bingo!!!
2018年2月16日 星期五
[Python 3.6] pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
venv建立新環境後,安裝套件又發生問題
[root@python newproject]# ./bin/pip3 install requestspip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.Collecting requests Could not fetch URL https://pypi.python.org/simple/requests/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping Could not find a version that satisfies the requirement requests (from versions: )No matching distribution found for requests
參考以下網站,為Python 3.6增加SSL能力(https://stackoverflow.com/questions/41489439/pip3-installs-inside-virtual-environment-with-python3-6-failing-due-to-ssl-modul)
(1) 安裝openssl套件
yum install -y openssl openssl-devel (CentOS 7.4)
(2) 修改Python編譯設定檔
cd /usr/src/Python-3.6.4
./configure
vi ./Module/Setup (uncomment below lines #209~212)
SSL=/usr/lib64/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
make
make altinstall
[root@python newproject]# ./bin/pip3 install requestspip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.Collecting requests Could not fetch URL https://pypi.python.org/simple/requests/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping Could not find a version that satisfies the requirement requests (from versions: )No matching distribution found for requests
參考以下網站,為Python 3.6增加SSL能力(https://stackoverflow.com/questions/41489439/pip3-installs-inside-virtual-environment-with-python3-6-failing-due-to-ssl-modul)
(1) 安裝openssl套件
yum install -y openssl openssl-devel (CentOS 7.4)
(2) 修改Python編譯設定檔
cd /usr/src/Python-3.6.4
./configure
vi ./Module/Setup (uncomment below lines #209~212)
SSL=/usr/lib64/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
make
make altinstall
[Python 3.6] Error: Command '['/home/newproject/bin/python3.6', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
python3.6下使用venv建立新專案環境時發生錯誤:
[root@python Home]# python3.6 -m venv /home/newproject
Error: Command '['/home/newproject/bin/python3.6', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
經搜尋,了解python3.6預設未安裝pip,且缺了ensurepip模組
(https://github.com/ContinuumIO/anaconda-issues/issues/6917)
(https://github.com/ContinuumIO/anaconda-issues/issues/6917)
實際執行模組確認,發生以下問題
[root@python Home]# python3.6 -m ensurepip.....(略).....
zipimport.ZipImportError: can't decompress data; zlib not available
再經過一番搜尋,
確認必須重編python3.6支援zlib解壓縮
(網路上有其他論壇寫到./configure --with-zlib-dir=... ,此參數試過不支援)
參考下方網頁Alex Zhou的作法,重新編譯
(http://zhoujianghai.iteye.com/blog/1521993):
注意:最後步驟我改為make altinstall,保留MacOS的Python2.7,
cd /usr/src/Python-3.6.4 (我的source解開後的位置)
./configurevi Modules/Setup
(找到下面這段,將註解符號去除讓它生效)
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
make
make altinstall
(找到下面這段,將註解符號去除讓它生效)
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
make
make altinstall
完成!
訂閱:
文章 (Atom)