STNSのクライアントを今入れ直してshellを作成する

STNSクライアントのインストール

STNSのレポジトリを追加

 $ curl -fsSL https://repo.stns.jp/scripts/apt-repo.sh | sed "s:apt-key add -:tee /etc/apt/trusted.gpg.d/stns.asc:" | sh
 ```

STNSクライアントのインストール
$ sudo apt install libnss-stns-v2 cache-stnsd
クライアントの設定を入れる
$ sudo vi /etc/stns/client/stns.conf
初期設定は以下のようになってる.
変える部分は,api_endpointの箇所
ここはSTNSサーバが入っているアドレス

変更前⇩
```config
#api_endpoint     = "http://<server-ip>:1104/v1/"
#auth_token        = "xxxxxxxxxxxxxxx"
#user              = "test_user"
#password          = "test_password"
#chain_ssh_wrapper = "/usr/libexec/openssh/ssh-ldap-wrapper"
#query_wrapper = "/usr/local/bin/stns-wrapper"
#ssl_verify        = true
#http_proxy        = "http://your.proxy.com"
#uid_shift         = 1000
#gid_shift         = 2000
#request_timeout   = 3
#request_retry     = 3

サーバ側のIPは192.168.20.11なので以下のように変更

api_endpoint     = "http://192.168.20.11:1104/v1/"
[cached]
enable = true
#auth_token        = "xxxxxxxxxxxxxxx"
#user              = "test_user"
#password          = "test_password"
#chain_ssh_wrapper = "/usr/libexec/openssh/ssh-ldap-wrapper"
#query_wrapper = "/usr/local/bin/stns-wrapper"
#ssl_verify        = true
#http_proxy        = "http://your.proxy.com"
#uid_shift         = 1000
#gid_shift         = 2000
#request_timeout   = 3
#request_retry     = 3

それ以外の設定

$ sudo vi /etc/nsswitch.conf

passwd, group, shadowにstnsを変更

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         files systemd stns
group:          files systemd stns
shadow:         files stns
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

STNSクライアントのリスタート

$ sudo systemctl restart cache-stnsd

sshdの設定

sudo vi /etc/ssh/sshd_config

PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile     .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

AuthorizedKeysCommand /usr/lib/stns/stns-key-wrapper
AuthorizedKeysCommandUser root
sshdの設定
$ sudo systemctl restart sshd

確認

idコマンドの確認

$ id nishimura
uid=3040(nishimura) gid=3300(students) groups=3300(students)

でけた