chshコマンドでログインシェルを変更する(chang login shell)
sudo chsh ユーザ名
実行すると、ログインシェルを問われるので、新しいシェルを指定する。
~$ sudo chsh web-user
Changing the login shell for web-user
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]:
chshコマンドでログインシェルを変更する(chang login shell)
sudo chsh ユーザ名
実行すると、ログインシェルを問われるので、新しいシェルを指定する。
~$ sudo chsh web-user
Changing the login shell for web-user
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]:
ユーザのプライマリグループは、usermod の-gオプションで実行する。
sudo usermod -g グループ名 ユーザ名
プライマリグループの確認は、groupsコマンドで確認する。1つ目のグループがプライマリグループ。
~$ groups zen zen : developers sudo
vsftpdで何も考えずに、SSLの設定をすると、明示的な暗号化(Explicit)になる。
# This option specifies the location of the RSA certificate to use for SSL # encrypted connections. rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key ssl_enable=YES
そのため、FTPSで接続する場合は、明示的な暗号化をクライアントソフト側で選ぶ。その場合のポートは、21番ポートが待ち受けになる。
暗黙的な暗号化(Implicit)にするためには、以下のようなimplicit_sslを有効化して、ポートの設定が必要。
implicit_ssl=YES listen_port=990
aptでインストールしたパッケージの一覧を表示するには、下記のコマンドを実行する。
apt list --installled
実行例)
zen:/var/log$ apt list --installed Listing... Done accountsservice/bionic,now 0.6.45-1ubuntu1 amd64 [installed] adduser/bionic,bionic,now 3.116ubuntu1 all [installed] adwaita-icon-theme/bionic,bionic,now 3.28.0-1ubuntu1 all [installed,automatic] amd64-microcode/bionic-updates,now 3.20180524.1~ubuntu0.18.04.2 amd64 [installed,automatic] apparmor/bionic-updates,bionic-security,now 2.12-4ubuntu5.1 amd64 [installed] apt/bionic-updates,now 1.6.8 amd64 [installed] apt-utils/bionic-updates,now 1.6.8 amd64 [installed]
ubuntu 18.04.02で、Nginx-fullをインストールしたときにインストールされているオプション。
“–with-http_ssl_module” と “–with-http_v2_module” がついているので、SSL化もHTTP/2化もすんなりとできる。
zen:/var/log$ nginx -V nginx version: nginx/1.14.0 (Ubuntu) built with OpenSSL 1.1.0g 2 Nov 2017 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-FIJPpj/nginx-1.14.0/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-FIJPpj/nginx-1.14.0/debian/modules/http-dav-ext --add-dynamic-module=/build/nginx-FIJPpj/nginx-1.14.0/debian/modules/http-echo --add-dynamic-module=/build/nginx-FIJPpj/nginx-1.14.0/debian/modules/http-upstream-fair --add-dynamic-module=/build/nginx-FIJPpj/nginx-1.14.0/debian/modules/http-subs-filter
Ubuntuでユーザをグループに追加するには、usermod -aGコマンドを使用する。 “-a”オプションも使用しないと、グループに追加されるわけではなく、副グループが切り替わってしまうので、注意。
sudo usermod -aG グループ名 ユーザ名
実行例)
$ sudo usermod -aG developers zen $ groups zen sudo developers
下記のように、aptの公開鍵を追加しようとしたところ、エラーが出た。
zen:~$ sudo curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xF1656F24C74CD1D8" | sudo apt-key add E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
gnupgがインストールされていないのが、原因なので、aptでインストール。
sudo apt install gnupg
gnupgのインストール後に、再度、試したところ、正常にapt公開鍵の追加が完了した。
Ubuntu Server 18.04 には、ifconfigがインストールされていないので、ipコマンドを使用する。
IPアドレスの確認であれば、”ip addr” で確認できる。
ip addr
ifconfigがなくなるとは。。。
Ubuntu 18.04 でvCenter Server 6.7 をインストールするために、インストーラをダブルクリックしたが、起動しない。 パスの問題かもしれないので、ターミナルからインストーラを起動させてみたところ、下記のエラーが表示された。
zen@vCenterServer67:/media/zen/VMware VCSA/vcsa-ui-installer/lin64$ ./installer ./installer: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
インストールに必要な「libgconf2-4」がUbuntu上にインストールされておらず、起動しないようだ。 なので、aptを使ってインストールする。
念のため、パッケージがあるかどうかを確認してから、インストール。
apt search libgconf2 sudo apt install libgconf2-4
正常にlibgconf2-4がインストールされた後に、vCenter Serverのインストーラを起動させたところ、正常にGUIが立ち上がった。
zen@vCenterServer67:~$ apt search libgconf2 ソート中... 完了 全文検索... 完了 libgconf2-4/bionic 3.2.6-4ubuntu1 amd64 GNOME 設定データベースシステム (ダミーパッケージ) libgconf2-dev/bionic 3.2.6-4ubuntu1 amd64 GNOME configuration database system (development) libgconf2-doc/bionic,bionic 3.2.6-4ubuntu1 all GNOME configuration database system (API reference) libgconf2.0-cil/bionic,bionic 2.24.2-4 all GConf 2.24 の CLI バインディング libgconf2.0-cil-dev/bionic,bionic 2.24.2-4 all GConf 2.24 の CLI バインディング zen@vCenterServer67:~$ zen@vCenterServer67:~$ zen@vCenterServer67:~$ sudo apt install libgconf2-4 [sudo] zen のパスワード: パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: gconf-service gconf-service-backend gconf2-common libgconf-2-4 以下のパッケージが新たにインストールされます: gconf-service gconf-service-backend gconf2-common libgconf-2-4 libgconf2-4 アップグレード: 0 個、新規インストール: 5 個、削除: 0 個、保留: 0 個。 847 kB のアーカイブを取得する必要があります。 この操作後に追加で 8,422 kB のディスク容量が消費されます。 続行しますか? [Y/n] Y 取得:1 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 gconf2-common all 3.2.6-4ubuntu1 [700 kB] 取得:2 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 libgconf-2-4 amd64 3.2.6-4ubuntu1 [84.8 kB] 取得:3 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 gconf-service-backend amd64 3.2.6-4ubuntu1 [58.1 kB] 取得:4 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 gconf-service amd64 3.2.6-4ubuntu1 [2,036 B] 取得:5 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 libgconf2-4 amd64 3.2.6-4ubuntu1 [2,044 B] 847 kB を 0秒 で取得しました (3,314 kB/s) 以前に未選択のパッケージ gconf2-common を選択しています。 (データベースを読み込んでいます ... 現在 171039 個のファイルとディレクトリがインストールされています。) .../gconf2-common_3.2.6-4ubuntu1_all.deb を展開する準備をしています ... gconf2-common (3.2.6-4ubuntu1) を展開しています... 以前に未選択のパッケージ libgconf-2-4:amd64 を選択しています。 .../libgconf-2-4_3.2.6-4ubuntu1_amd64.deb を展開する準備をしています ... libgconf-2-4:amd64 (3.2.6-4ubuntu1) を展開しています... 以前に未選択のパッケージ gconf-service-backend を選択しています。 .../gconf-service-backend_3.2.6-4ubuntu1_amd64.deb を展開する準備をしています ... gconf-service-backend (3.2.6-4ubuntu1) を展開しています... 以前に未選択のパッケージ gconf-service を選択しています。 .../gconf-service_3.2.6-4ubuntu1_amd64.deb を展開する準備をしています ... gconf-service (3.2.6-4ubuntu1) を展開しています... 以前に未選択のパッケージ libgconf2-4:amd64 を選択しています。 .../libgconf2-4_3.2.6-4ubuntu1_amd64.deb を展開する準備をしています ... libgconf2-4:amd64 (3.2.6-4ubuntu1) を展開しています... gconf2-common (3.2.6-4ubuntu1) を設定しています ... Creating config file /etc/gconf/2/path with new version libgconf-2-4:amd64 (3.2.6-4ubuntu1) を設定しています ... libc-bin (2.27-3ubuntu1) のトリガを処理しています ... gconf-service (3.2.6-4ubuntu1) を設定しています ... gconf-service-backend (3.2.6-4ubuntu1) を設定しています ... libgconf2-4:amd64 (3.2.6-4ubuntu1) を設定しています ... zen@vCenterServer67:~$
Linuxにアクセスするとき、通常はCLIで事足りるのでsshdの設定だけでよいのだが、いろいろとインストールするのに、GUIを使いたかった。Ubuntu(18.04 LTS)のデスクトップにリモートアクセスするときに、いろいろと調べていたら、xrdpを使えば、Windowsのリモートデスクトップクライアント(mstsc.exe)でアクセスできるとのこと。
そんなわけで、xrdpをインストールして、設定してみた。
xrdpをインストール
~$ sudo apt install xrdp
次に、xrdpの設定を変更。「new_cursors」の設定を無効化する。そして、サービスを再起動。
~$ sudo sed -e 's/^new_cursors=true/new_cursors=false/g' -i /etc/xrdp/xrdp.ini ~$ sudo systemctl restart xrdp
「.xsessionrc」を作成する。これは、参考にしたページで紹介されていたものをまるっと流用。
~$ D=/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop ~$ cat <~/.xsessionrc > export GNOME_SHELL_SESSION_MODE=ubuntu > export XDG_CURRENT_DESKTOP=ubuntu:GNOME > export XDG_DATA_DIRS=${D} > export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg > EOF
Authentication Requiredの回避設定を行う。これをやらないとダメだった(先人は偉大)。 「/etc/polkit-1/localauthority/50-local.d/xrdp-color-manager.pkla」の設定を変更する。
~$ sudo cat /etc/polkit-1/localauthority/50-local.d/xrdp-color-manager.pkla [Netowrkmanager] Identity=unix-user:* Action=org.freedesktop.color-manager.create-device ResultAny=no ResultInactive=no ResultActive=yes
polkitのサービスを再起動する。
sudo systemctl restart polkit
Windowsからリモートデスクトップクライアントで接続する。
参考: https://www.hiroom2.com/2018/04/28/ubuntu-1804-xrdp-gnome-ja/
インストールしたときのログ
zen@ubClient:~$ zen@ubClient:~$ apt search xrdp ソート中... 完了 全文検索... 完了 xorgxrdp/bionic 0.9.5-2 amd64 Remote Desktop Protocol (RDP) modules for X.org xrdp/bionic 0.9.5-2 amd64 Remote Desktop Protocol (RDP) server xrdp-pulseaudio-installer/bionic 0.9.5-2 amd64 Remote Desktop Protocol (RDP) server - PulseAudio module installer zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ sudo apt install xrdp [sudo] zen のパスワード: パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: xorgxrdp 提案パッケージ: guacamole xrdp-pulseaudio-installer 以下のパッケージが新たにインストールされます: xorgxrdp xrdp アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 0 個。 498 kB のアーカイブを取得する必要があります。 この操作後に追加で 3,303 kB のディスク容量が消費されます。 続行しますか? [Y/n] Y 取得:1 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 xorgxrdp amd64 0.9.5-2 [78.7 kB] 取得:2 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 xrdp amd64 0.9.5-2 [419 kB] 498 kB を 0秒 で取得しました (3,298 kB/s) 以前に未選択のパッケージ xorgxrdp を選択しています。 (データベースを読み込んでいます ... 現在 170920 個のファイルとディレクトリがインストールされています。) .../xorgxrdp_0.9.5-2_amd64.deb を展開する準備をしています ... xorgxrdp (0.9.5-2) を展開しています... 以前に未選択のパッケージ xrdp を選択しています。 .../xrdp_0.9.5-2_amd64.deb を展開する準備をしています ... xrdp (0.9.5-2) を展開しています... ureadahead (0.100.0-20) のトリガを処理しています ... libc-bin (2.27-3ubuntu1) のトリガを処理しています ... xrdp (0.9.5-2) を設定しています ... Generating 2048 bit rsa key... ssl_gen_key_xrdp1 ok saving to /etc/xrdp/rsakeys.ini Created symlink /etc/systemd/system/multi-user.target.wants/xrdp-sesman.service → /lib/systemd/system/xrdp-sesman.service. Created symlink /etc/systemd/system/multi-user.target.wants/xrdp.service → /lib/systemd/system/xrdp.service. systemd (237-3ubuntu10.11) のトリガを処理しています ... man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ... xorgxrdp (0.9.5-2) を設定しています ... libc-bin (2.27-3ubuntu1) のトリガを処理しています ... ureadahead (0.100.0-20) のトリガを処理しています ... zen@ubClient:~$ zen@ubClient:~$ cat /etc/xrdp/xrdp.ini | grep new_cursors new_cursors=true zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ sudo sed -e 's/^new_cursors=true/new_cursors=false/g' -i /etc/xrdp/xrdp.ini [sudo] zen のパスワード: zen@ubClient:~$ zen@ubClient:~$ cat /etc/xrdp/xrdp.ini | grep new_cursors new_cursors=false zen@ubClient:~$ zen@ubClient:~$ sudo systemctl restart xrdp zen@ubClient:~$ zen@ubClient:~$ D=/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ cat <~/.xsessionrc > export GNOME_SHELL_SESSION_MODE=ubuntu > export XDG_CURRENT_DESKTOP=ubuntu:GNOME > export XDG_DATA_DIRS=${D} > export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg > EOF zen@ubClient:~$ zen@ubClient:~$ zen@ubClient:~$ sudo usermod -aG xrdp zen zen@ubClient:~$ sudo emacs /etc/polkit-1/localauthority/50-local.d/xrdp-c olor-manager.pkla zen@ubClient:~$ sudo cat /etc/polkit-1/localauthority/50-local.d/xrdp-color-manager.pkla [Netowrkmanager] Identity=unix-user:* Action=org.freedesktop.color-manager.create-device ResultAny=no ResultInactive=no ResultActive=yes zen@ubClient:~$ zen@ubClient:~$ sudo systemctl restart polkit