0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OCI-Oracle Linuxで複数ユーザで共用できるRust開発環境のユーザを設定・作成する

0
Posted at

前の記事

構築編

Rust共通ユーザ設定の作成

1.独自テンプレートの作成

/etc/skel:新ユーザーのホームディレクトリに自動コピーされるファイルがある場所

1.1.オリジナルの確認

オリジナルskelの確認 ```shell-session [opc@test-server ~]$ ls -al /etc/skel total 24 drwxr-xr-x. 2 root root 62 Xxx 99 2029 . drwxr-xr-x. 137 root root 8192 Xxx 99 99:99 .. -rw-r--r--. 1 root root 18 Xxx 99 2029 .bash_logout -rw-r--r--. 1 root root 141 Xxx 99 2029 .bash_profile -rw-r--r--. 1 root root 492 Xxx 99 2029 .bashrc ```

1.2.独自skelディレクトリの作成

独自skelディレクトリの作成 ```shell-session [opc@test-server ~]$ sudo mkdir -p /etc/skel_rust_dev [opc@test-server ~]$ ```

1.3.bashrcファイルのコピー

.bashrcファイルのコピー .bashrcファイルは、ログイン時に実行されるファイル ```shell-session [opc@test-server ~]$ sudo cp /etc/skel/.bashrc /etc/skel_rust_dev/ [opc@test-server ~]$ ```

1.4.bashrcファイルへの設定追加

.bashrcファイルの編集
[opc@test-server ~]$ sudo vi /etc/skel_rust_dev/.bashrc
ver ~]$ sudo vi /etc/skel_rust_dev/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
(以下略)

最後に以下の2行を追加する


# For Rust User
export RUSTUP_HOME=/usr/local/rust/rustup
export CARGO_HOME=/usr/local/rust/cargo

2.Rust開発環境ユーザーの追加

2.1.ユーザー追加

ユーザー追加コマンドの実行 useradd -m -kで実施

ユーザー追加コマンドの実行

[opc@test-server ~]$ sudo useradd -m -k /etc/skel_rust_dev rust0001
[opc@test-server ~]$ 
コマンド オプション 意味 備考
-m ホームディレクトリを作成
-k ユーザープロファイルを指定 /etc/skel_rust_dev を指定
rust0001 作成するユーザー名

3.Rust開発環境ユーザー動作確認

2.1.ユーザー追加

ユーザー追加コマンドの実行 useradd -m -kで実施

ユーザー追加コマンドの実行

[opc@test-server ~]$ sudo useradd -m -k /etc/skel_rust_dev rust0001
[opc@test-server ~]$ 
コマンド オプション 意味 備考
-m ホームディレクトリを作成
-k ユーザープロファイルを指定 /etc/skel_rust_dev を指定
rust0001 作成するユーザー名

パスワードの設定

[opc@test-server ~]$ [opc@test-server ~]$ sudo passwd rust0001
Changing password for user rust0001.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

2.2.ユーザー動作確認

ログイン後の確認

Rust設定パスの確認

[rust0001@test-server opc]$ echo $RUSTUP_HOME
/usr/local/rust/rustup
[rust0001@test-server opc]$ echo $CARGO_HOME
/usr/local/rust/cargo
[rust0001@test-server opc]

Rustコンパイラの動作確認

[rust0001@test-server opc]$ rustc --version
rustc 1.99.9 (9999999999 2099-99-99)
[rust0001@test-server opc]$

最後に

記事の内容はCC BY-SA 4.0(著作者の情報とCCライセンス継承はお願いします。商用利用・改変・再配布は問題なし)です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?