Linux

共 9 篇文章

單人用的NFS idmapping

1 分鐘閱讀

Introduction

NFS雖然是很方便的掛載方法,但不像samba或sshfs一樣可以做身份認證
本機的UID是什麼寫入到NFS server的UID就是什麼

e.g. 本機的UID是1001, username是hunglin
但NFS server的hunglin的UID是1000
但寫入到遠端的檔案會顯示1001而不是hunglin

本機
{% code %} drwxr-sr-x 7 hunglin hunglin 10M Mar 1 2022 file.txt {% endcode %}

NFS server {% code %} drwxr-sr-x 7 1001 1001 10M Mar 1 2022 file.txt {% endcode %}

如果NFS server和本機都只有自己使用的話有個方法可以間接的mapping id

指定匿名ID

NFS server端可以在/etc/export設定anonymous的uid和gid

all_squash,anonuid=1001,anongid=1001

https://linux.die.net/man/5/exports

all_squash是指將寫入的檔案的user和group都壓縮成anonymous的uid和gid
只要將anonuid和anongid設定成server端user的uid和gid就可以做到idmapping

重啟nfs server {% code lang:sh %} sudo /etc/init.d/nfs-kernel-server restart sudo start idmapd {% endcode %}

How to use ncat or socat to map the remote port to local server

1 分鐘閱讀

Introduction

ncat和socat都是linux的網路工具
這次主題要達成的目標用這兩個都能達成

他們可以做到: 只要是能夠訪問到的port都可以把它映射到本機的port上

寫這篇也是要介紹之前寫reverse proxy的文章的額外補充

docker瞬間佈署reverse_proxy還有SSL認證

那篇是以frp做到內網穿透,而另一個方法是結合ncat和zerotier達到相同效果
目標都是把遠端的port映射到本機的port

Ubuntu 22.04 setup after installation

2 分鐘閱讀

The following setup is my customization while ubuntu initialization

Operating System

Input method

fcitx5-rime

sudo apt install fctix5-*
im-config  

勉強適合Ubuntu22.04的中文輸入法

nfs-common

sudo apt install nfs-common
sudo mount -t nfs $remote_host:/remote/path /local/path

GNOME

window minimize

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

circle windows

gsettings set org.gnome.shell.extensions.dash-to-dock scroll-action 'cycle-windows'

If the commands are not working, you can install dconf-editor to set.

Switching between windows with scroll wheel on Ubuntu Dock
Essential Guide: How to Enable ‘Minimize on Click’ on Ubuntu Quickly

勉強適合Ubuntu22.04的中文輸入法

1 分鐘閱讀

要界面像微軟新注音的輸入法以前我都是用gcin
它可以在打注音後用上下鍵選字
ibus預設的中文輸入要用主鍵盤上的0-9選字…
20.4時用gcin還很方便,但它在22.04就不完全支援了
在瀏覽器或一些應用程式無法打字

最後找到的替代方案是fcitx5-rime
它至少可以像新注音那樣選字
fcitx5是種輸入法框架
rime則是種輸入法引擎

一條網路線連接兩台電腦分享網路(win10 & Ubuntu18.04)

3 分鐘閱讀

使用情境:手邊沒有路由器或橋接器,網路來源是手機網路且只有一台電腦有無線網卡可接收wifi,另一台則只有有線網路孔(很可憐的情境…)。 實際上硬體配置如下圖一隻手機開熱點分享網路,主電腦接收wifi再透過網路線分享網路給客電腦

Install R and RStudio in Ubuntu 18.04

1 分鐘閱讀

前陣子把ubuntu成功安裝到外接硬碟中了 也是遮疼了很久…

再來想要把自己常用的軟體也安裝進去 結果又是遮疼了很久… 尚不專精就是這樣 只能用時間換結果