Linuxユーザーを作成。
useradd hoge
ログインパスワードを設定
passwd hoge
作成ユーザーでsudo
をパスワードなしで実行可能にする
visudo
下記の記述を追加
hoge ALL=(ALL) NOPASSWD: ALL
ユーザの切り替え
su - hoge
gitをインストールする
sudo dnf -y update
sudo dnf install -y git-all
ssh-keygen -t ed25519 -C "hoge@example.com"
鍵の作成後にGithubアカウントに対して新しいsshキーを追加する。
端末のgitを設定する。
git config --global user.name "hoge"
git config --global user.email "hoge@example.com"
# editor でvimを指定
git config --global core.editor 'vim -c "set fenc=utf-8"'
設定完了後にGithubからリポジトリをpullする。
git clone git@github.com:tetsunari/compute-engine-FTP.git
rootユーザーで下記コマンドを実行
cat <<EOF >/etc/systemd/system/autorun.service
[Unit]
Description=VM起動時にシェルスクリプト実行
Documentation=
After=network-online.target
[Service]
User=root
ExecStart=/bin/sh /home/lettuce-ftp/lan-tern-pos-ftp/infrastructure/ftp_script.sh
SyslogIdentifier=Diskutilization
[Install]
WantedBy=multi-user.target
EOF
systemctl enabled autorun.service
rootユーザーで下記コマンドを実行
sh compute-engine-FTP/ftp_script.sh
rootユーザーで下記コマンドを実行
vim /etc/vsftpd/user_list
→hoge-ftp(追加)
mkdir /etc/vsftpd/user_conf
vi /etc/vsftpd/user_conf/hoge-ftp
→local_root=/home/hoge-ftp/ftp_dir(追加)
mkdir /home/hoge-ftp/ftp_dir
chmod 777 /home/hoge-ftp/ftp_dir
reboot
ssh-keygen -t rsa -b 4096 -C “hoge-ftp@stage” -f ~/.ssh/stage_sftp_rsa