ポートバインドとsocksプロキシを使ったjupyter notebookへの遠隔アクセス
学内のサーバーに構築したjupyter notebookの環境に家からアクセスしたいなと思いたった。
sshのポートバインドとfirefoxのsocksプロキシ機能を使って家から学内のjupyter環境にアクセスできたのでその備忘録 。
jupyter notebookの外部アクセスを許可する設定はしてある前提で進めます(ググるとたくさん出てくる)
自宅PCでtmuxやscreenなどで使用したい学内のjupyter notebookへのsshを張ります。 学内PCの8888ポートでjupyter notebookが動いているため、-Dオプションで8888を指定
ssh -J User_A@hostname_A User_B@hostname_B -D 8888
次にsocksサーバーの設定をfirefoxで行います。
設定→ネットワーク設定→接続設定
手動でプロキシを設定する→下記のように入力
あとはfirefoxで下記アドレスを入力してアクセス hostname_B:8888
M1mac VScode insidersのエイリアスを短くする(fish shell)
VS code insidersのエイリアスが長い(code-insiders)ので短くしたかった。 参考程度にどうぞ
codeコマンドが使えることが前提です。 https://code.visualstudio.com/docs/setup/mac
$ sudo vi ~/.config/fish/config.fish
config.fishに下記を追記
alias c='code-insiders'
configファイルを読み込んで新しいエイリアスを適用
$ source ~/.config/fish/config.fish
Jupyter labでモジュールを自動的にリロードする際の設定
$ ipython3 profile create [ProfileCreate] Generating default config file: '/home/jake/.ipython/profile_default/ipython_config.py' [ProfileCreate] Generating default config file: '/home/jake/.ipython/profile_default/ipython_kernel_config.py' vim ~/.ipython/profile_default/ipython_config.py c.InteractiveShellApp.extensions = ['autoreload'] c.InteractiveShellApp.exec_lines = ['%autoreload 2']
from IPython.lib.deepreload import reload %load_ext autoreload %autoreload 2
Visual Studio Code で Remote SSHしたい(macOS to Ubuntu) ときに起こったfishによる問題
VSCodeの拡張機能Remoto-SSHを使ってローカルのmacOSからリモート先のUbuntuにSSH接続をする際にコネクションエラーが起こったのでその対処をメモ程度に書きます。
- Local OS Version: macOS 10.15.5
- Remote OS Version: Ubuntu 18.04.4 LTS
- VSCode Version: 1.47.0
- Remote -SSH(VSCode Extension) 0.51.0
鍵生成や鍵の登録方法は省略して SSHのconfigファイルの中身
Host x.x.x.x HostName x.x.x.x Port 22 User [ユーザーネーム] IdentityFile Users/[ユーザーネーム]/.ssh/id_rsa
ssh接続しようとしたらこんなエラーが出た 接続先は認識してるがssh接続がなぜかタイムアウト
[16:21:51.720] Log Level: 2 [16:21:51.722] remote-ssh@0.51.0 [16:21:51.722] darwin x64 [16:21:51.725] SSH Resolver called for "ssh-remote+xxx.xxx.xxx.xxx", attempt 1 [16:21:51.725] SSH Resolver called for host: xxx.xxx.xxx.xxx [16:21:51.726] Setting up SSH remote "xxx.xxx.xxx.xxx" [16:21:51.731] Acquiring local install lock: /var/folders/p1/y07_pnvn3jvfc0txspt_z7lr0000gn/T/vscode-remote-ssh-xxx.xxx.xxx.xxx-install.lock [16:21:51.791] Looking for existing server data file at /Users/[USER NAME]/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-xxx.xxx.xxx.xxx-d5e9aa0227e057a60c82568bf31c04730dc15dcd-0.51.0/data.json [16:21:51.810] Using commit id "d5e9aa0227e057a60c82568bf31c04730dc15dcd" and quality "stable" for server [16:21:51.812] Install and start server if needed [16:21:51.817] Checking ssh with "ssh -V" [16:21:51.829] > OpenSSH_8.1p1, LibreSSL 2.7.3 [16:21:51.832] askpass server listening on /var/folders/p1/y07_pnvn3jvfc0txspt_z7lr0000gn/T/vscode-ssh-askpass-0c47d7ee4ffbc7bd8ccf646e8125dd342fd3ea7e.sock [16:21:51.832] Spawning local server with {"ipcHandlePath":"/var/folders/p1/y07_pnvn3jvfc0txspt_z7lr0000gn/T/vscode-ssh-askpass-3c099fdd00763f0e927570ad4f67a1798e063760.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","64247","-o","ConnectTimeout=15","xxx.xxx.xxx.xxx"],"dataFilePath":"/Users/[USER NAME]/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-xxx.xxx.xxx.xxx-d5e9aa0227e057a60c82568bf31c04730dc15dcd-0.51.0/data.json"} [16:21:51.832] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/[USER NAME]/.vscode/extensions/ms-vscode-remote.remote-ssh-0.51.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer)","VSCODE_SSH_ASKPASS_MAIN":"/Users/[USER NAME]/.vscode/extensions/ms-vscode-remote.remote-ssh-0.51.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/p1/y07_pnvn3jvfc0txspt_z7lr0000gn/T/vscode-ssh-askpass-0c47d7ee4ffbc7bd8ccf646e8125dd342fd3ea7e.sock"} [16:21:51.835] Spawned 96887 [16:21:51.987] > local-server> Spawned ssh: 96888 [16:21:51.995] stderr> OpenSSH_8.1p1, LibreSSL 2.7.3 [16:21:52.026] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:OfTr9OpC5gUwEg4LSiFsnEt9GS93nDnaSnp5csS2wR0 [16:21:52.161] Got askpass request: {"request":"Enter passphrase for key 'Users/[USER NAME]/.ssh/id_rsa':"} [16:21:52.162] Detected passphrase message [16:21:52.164] Listening for interwindow password on /var/folders/p1/y07_pnvn3jvfc0txspt_z7lr0000gn/T/vscode-ssh-askpass-e835a6c55dec0bcdf39d695d88e4c888940c2655.sock [16:21:52.164] Writing password prompt to globalState [16:24:29.023] Got passphrase response [16:24:29.023] Interactor gave response: *********** [16:24:29.024] Cleaning up other-window auth server [16:24:29.045] stderr> Connection closed by xxx.xxx.xxx.xxx port 22 [16:24:29.046] > local-server> ssh child died, shutting down [16:24:29.050] Local server exit: 0 [16:24:29.051] Received install output: OpenSSH_8.1p1, LibreSSL 2.7.3 debug1: Server host key: ecdsa-sha2-nistp256 SHA256:OfTr9OpC5gUwEg4LSiFsnEt9GS93nDnaSnp5csS2wR0 Connection closed by xxx.xxx.xxx.xxx port 22 [16:24:29.052] Stopped parsing output early. Remaining text: OpenSSH_8.1p1, LibreSSL 2.7.3debug1: Server host key: ecdsa-sha2-nistp256 SHA256:OfTr9OpC5gUwEg4LSiFsnEt9GS93nDnaSnp5csS2wR0Connection closed by xxx.xxx.xxx.xxx port 22 [16:24:29.052] Failed to parse remote port from server output [16:24:29.053] Resolver error: [16:24:29.056] ------
原因を調べたところ、Ubuntuのシェルをbashではなくfishを使ってたことが原因っぽい
正確に言えば.bachrcの最後の行にexec fishを追記していた感じ
下記リンクによるとRemoto-SSHのバージョンを0.49.0に下げれば解決するらしい(した)
VSCodeの拡張機能の画面でRemote-SSHの歯車を押すと別のバージョンをインストールと出てくるのでこれを選択する
github.com
Mandeley Desktop(mac OS)が起動時にcrashする時の対処
文献管理にMandeleyを使用しているのですが、ある時から起動時にクラッシュしてしまうようになってしまいました。
どういう対処をしたのかメモ程度に書き留めます。
こんな起動時のエラー
$ cd /Applications/Mendeley\ Desktop.app/Contents/MacOS/ $ ./"Mendeley Desktop" App path does not exist: "/Applications/Microsoft Office 2011/Microsoft Word.app" Crash handler wrote minidump /Users/[user name]/Library/Application Support/Mendeley Desktop/minidumps/xxxxxxxx.dmp
対処
$ cd ~/Library/Preferences/ $ ls -a | grep mendeley com.mendeley.Mendeley Desktop.plist com.mendeley.desktop.plist $ rm com.mendeley*