2023年3月15日水曜日

xubuntu22.04でsambaを使ってホームディレクトリを共有

 昨日から今日で測定用のxubuntuをdo-release-upgradeして20.04から22.04にしました。

データを共有するためにsambaをインストール

$ sudo apt install samba

設定ファイル/etc/smb.confに以下を付け加える。

[<ユーザ名>]

path = /home/<ユーザ名>

browsable = yes

writable = yes

guest ok = no

read only = no

もちろん,<ユーザ名>のところは共有したいユーザ名。

最後に,パスワード設定

$ sudo smbpasswd -a username <ユーザ名>

求められるがままにパスワードを設定する。

その後,

$ sudo systemctl restart smbd nmbd

うまくアクセスできたら,起動時に有効になるように,

$ sudo systemctl enable smbd nmbd


あとは,macならFinderでコマンドキー+Kで移動メニューを表示して,smb://<ipアドレス>/<ユーザ名>へ接続。

先ほどのユーザ名とパスワードで接続できます。





2023年3月14日火曜日

x11vncをXubuntu20.04にインストールし,windowsのrdpやmacの画面共有のようにディスプレイに表示された画面をそのままコントロール

 Ubuntuにx11vncを入れる場合は,lightdmをインストールして云々とやる必要があるが,xubuntuはそもそもlightdmなのでその必要がない。


x11vncをインストールした後,パスワードファイルを生成する。


$ sudo x11vnc -storepasswd /etc/x11vnc.pass

[sudo]  <username> のパスワード: 

Enter VNC password: 

Verify password:    

Write password to /etc/x11vnc.pass?  [y]/n y

Password written to: /etc/x11vnc.pass


その後,自動起動のためのファイルを作成。


~$ sudo vi /etc/systemd/system/x11vnc.service



内容はこんな感じ


~$ more /etc/systemd/system/x11vnc.service 

[Unit] 

Description=Start x11vnc at startup. 

After=multi-user.target

[Service] 

Type=simple 

ExecStart=/usr/bin/x11vnc -auth guess -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -xkb -loop -shared -repeat -rfbport 5900 -o /var/log/x11vnc.log


[Install] 

WantedBy=multi-user.target


起動はsystemctlで。

自動起動するためには,systemctlでenableを指定。


$ sudo systemctl enable x11vnc

Created symlink /etc/systemd/system/multi-user.target.wants/x11vnc.service → /etc/systemd/system/x11vnc.service.


無事リンクが貼られて自動起動の準備ができた模様。

確認する。

$ ls -l /etc/systemd/system/multi-user.target.wants/

合計 0

lrwxrwxrwx 1 root root 40  3月 14 18:48 ModemManager.service -> /lib/systemd/system/ModemManager.service

lrwxrwxrwx 1 root root 42  3月 14 18:48 NetworkManager.service -> /lib/systemd/system/NetworkManager.service

lrwxrwxrwx 1 root root 35  3月 14 18:48 anacron.service -> /lib/systemd/system/anacron.service

lrwxrwxrwx 1 root root 40  3月 14 18:48 avahi-daemon.service -> /lib/systemd/system/avahi-daemon.service

lrwxrwxrwx 1 root root 45  3月 14 18:48 blueman-mechanism.service -> /lib/systemd/system/blueman-mechanism.service

lrwxrwxrwx 1 root root 41  3月 14 18:48 console-setup.service -> /lib/systemd/system/console-setup.service

lrwxrwxrwx 1 root root 32  3月 14 18:48 cron.service -> /lib/systemd/system/cron.service

lrwxrwxrwx 1 root root 40  3月 14 18:48 cups-browsed.service -> /lib/systemd/system/cups-browsed.service

lrwxrwxrwx 1 root root 29  3月 14 18:48 cups.path -> /lib/systemd/system/cups.path

lrwxrwxrwx 1 root root 33  3月 14 18:48 dmesg.service -> /lib/systemd/system/dmesg.service

lrwxrwxrwx 1 root root 39  3月 14 18:48 grub-common.service -> /lib/systemd/system/grub-common.service

lrwxrwxrwx 1 root root 48  3月 14 18:48 grub-initrd-fallback.service -> /lib/systemd/system/grub-initrd-fallback.service

lrwxrwxrwx 1 root root 38  3月 14 18:48 irqbalance.service -> /lib/systemd/system/irqbalance.service

lrwxrwxrwx 1 root root 38  3月 14 18:48 kerneloops.service -> /lib/systemd/system/kerneloops.service

lrwxrwxrwx 1 root root 38  3月 14 18:48 lm-sensors.service -> /lib/systemd/system/lm-sensors.service

lrwxrwxrwx 1 root root 47  3月 14 18:48 networkd-dispatcher.service -> /lib/systemd/system/networkd-dispatcher.service

lrwxrwxrwx 1 root root 36  3月 14 18:48 ondemand.service -> /lib/systemd/system/ondemand.service

lrwxrwxrwx 1 root root 36  3月 14 18:48 pppd-dns.service -> /lib/systemd/system/pppd-dns.service

lrwxrwxrwx 1 root root 36  3月 14 18:48 remote-fs.target -> /lib/systemd/system/remote-fs.target

lrwxrwxrwx 1 root root 33  3月 14 18:48 rsync.service -> /lib/systemd/system/rsync.service

lrwxrwxrwx 1 root root 35  3月 14 18:48 rsyslog.service -> /lib/systemd/system/rsyslog.service

lrwxrwxrwx 1 root root 41  3月 14 18:48 secureboot-db.service -> /lib/systemd/system/secureboot-db.service

lrwxrwxrwx 1 root root 52  3月 14 19:04 snapd.aa-prompt-listener.service -> /lib/systemd/system/snapd.aa-prompt-listener.service

lrwxrwxrwx 1 root root 42  3月 14 18:48 snapd.apparmor.service -> /lib/systemd/system/snapd.apparmor.service

lrwxrwxrwx 1 root root 44  3月 14 18:48 snapd.autoimport.service -> /lib/systemd/system/snapd.autoimport.service

lrwxrwxrwx 1 root root 44  3月 14 18:48 snapd.core-fixup.service -> /lib/systemd/system/snapd.core-fixup.service

lrwxrwxrwx 1 root root 58  3月 14 18:48 snapd.recovery-chooser-trigger.service -> /lib/systemd/system/snapd.recovery-chooser-trigger.service

lrwxrwxrwx 1 root root 40  3月 14 18:48 snapd.seeded.service -> /lib/systemd/system/snapd.seeded.service

lrwxrwxrwx 1 root root 33  3月 14 18:48 snapd.service -> /lib/systemd/system/snapd.service

lrwxrwxrwx 1 root root 31  3月 14 19:21 ssh.service -> /lib/systemd/system/ssh.service

lrwxrwxrwx 1 root root 44  3月 14 18:48 systemd-resolved.service -> /lib/systemd/system/systemd-resolved.service

lrwxrwxrwx 1 root root 36  3月 14 18:48 thermald.service -> /lib/systemd/system/thermald.service

lrwxrwxrwx 1 root root 31  3月 14 19:04 tlp.service -> /lib/systemd/system/tlp.service

lrwxrwxrwx 1 root root 42  3月 14 18:48 ua-reboot-cmds.service -> /lib/systemd/system/ua-reboot-cmds.service

lrwxrwxrwx 1 root root 44  3月 14 18:48 ubuntu-advantage.service -> /lib/systemd/system/ubuntu-advantage.service

lrwxrwxrwx 1 root root 31  3月 14 18:48 ufw.service -> /lib/systemd/system/ufw.service

lrwxrwxrwx 1 root root 47  3月 14 18:48 unattended-upgrades.service -> /lib/systemd/system/unattended-upgrades.service

lrwxrwxrwx 1 root root 36  3月 14 18:48 whoopsie.service -> /lib/systemd/system/whoopsie.service

lrwxrwxrwx 1 root root 42  3月 14 18:48 wpa_supplicant.service -> /lib/systemd/system/wpa_supplicant.service

lrwxrwxrwx 1 root root 34  3月 14 20:14 x11vnc.service -> /etc/systemd/system/x11vnc.service


ちゃんと一番最後にいる。

ここで気付いたのですが,先ほどつくったx11vnc.serviceファイルは/etcじゃなくて/libの下に作るべきだったのかもしれません。