teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

6

訂正

2018/04/18 09:31

投稿

nullpon
nullpon

スコア5739

answer CHANGED
@@ -16,6 +16,7 @@
16
16
  ```
17
17
 
18
18
  追記2.5
19
+ ```bash
19
20
  $ cat rc
20
21
  [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/
21
22
  $ sftp <your server>

5

追記2.5

2018/04/18 09:31

投稿

nullpon
nullpon

スコア5739

answer CHANGED
@@ -1,7 +1,7 @@
1
- つssh -t <user>@<server> bash --noprofile -l -i
1
+ つssh -t <your server> bash --noprofile -l -i
2
2
 
3
- 追記
3
+ 追記1
4
- つssh -t <user>@<server> sudo -e /etc/profile.d/tomcat.sh
4
+ つssh -t <your server> sudo -e /etc/profile.d/tomcat.sh
5
5
 
6
6
  追記2
7
7
  これではどうでしょう。
@@ -11,10 +11,23 @@
11
11
  $ cat rc
12
12
  [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/
13
13
 
14
- $ scp rc <user>@<server>:.ssh/
14
+ $ scp rc <your server> :.ssh/
15
- $ ssh <user>@<server>
15
+ $ ssh <your server>
16
16
  ```
17
17
 
18
+ 追記2.5
19
+ $ cat rc
20
+ [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/
21
+ $ sftp <your server>
22
+ sftp> cd .ssh
23
+ sftp> put rc
24
+ Uploading rc to /home/<user>/.ssh/rc
25
+ rc 100% 94 71.8KB/s 00:00
26
+ sftp> quit
27
+
28
+ $ ssh <your server>
29
+ ```
30
+
18
31
  追記3
19
32
  シングルユーザーモードを試して下さい。
20
33
  つ[https://null-i.net/index.html?Linux/%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%A6%E3%83%BC%E3%82%B6%E8%B5%B7%E5%8B%95%EF%BC%88%E3%81%95%E3%81%8F%E3%82%89VPS%E3%81%A7CentOS7%EF%BC%89](https://null-i.net/index.html?Linux/%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%A6%E3%83%BC%E3%82%B6%E8%B5%B7%E5%8B%95%EF%BC%88%E3%81%95%E3%81%8F%E3%82%89VPS%E3%81%A7CentOS7%EF%BC%89)

4

追記3

2018/04/18 09:30

投稿

nullpon
nullpon

スコア5739

answer CHANGED
@@ -13,4 +13,8 @@
13
13
 
14
14
  $ scp rc <user>@<server>:.ssh/
15
15
  $ ssh <user>@<server>
16
- ```
16
+ ```
17
+
18
+ 追記3
19
+ シングルユーザーモードを試して下さい。
20
+ つ[https://null-i.net/index.html?Linux/%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%A6%E3%83%BC%E3%82%B6%E8%B5%B7%E5%8B%95%EF%BC%88%E3%81%95%E3%81%8F%E3%82%89VPS%E3%81%A7CentOS7%EF%BC%89](https://null-i.net/index.html?Linux/%E3%82%B7%E3%83%B3%E3%82%B0%E3%83%AB%E3%83%A6%E3%83%BC%E3%82%B6%E8%B5%B7%E5%8B%95%EF%BC%88%E3%81%95%E3%81%8F%E3%82%89VPS%E3%81%A7CentOS7%EF%BC%89)

3

訂正

2018/04/18 09:05

投稿

nullpon
nullpon

スコア5739

answer CHANGED
@@ -7,6 +7,7 @@
7
7
  これではどうでしょう。
8
8
  ログイン時に~/.ssh/rcが/etc/profile.d/より先に実行されるはずです。
9
9
  ```bash
10
+ $ echo '[[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/' > rc
10
11
  $ cat rc
11
12
  [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/
12
13
 

2

追記2

2018/04/18 08:14

投稿

nullpon
nullpon

スコア5739

answer CHANGED
@@ -1,4 +1,15 @@
1
- つssh -t <your server> bash --noprofile -l -i
1
+ つssh -t <user>@<server> bash --noprofile -l -i
2
2
 
3
3
  追記
4
- つssh -t <your server> sudo -e /etc/profile.d/tomcat.sh
4
+ つssh -t <user>@<server> sudo -e /etc/profile.d/tomcat.sh
5
+
6
+ 追記2
7
+ これではどうでしょう。
8
+ ログイン時に~/.ssh/rcが/etc/profile.d/より先に実行されるはずです。
9
+ ```bash
10
+ $ cat rc
11
+ [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/
12
+
13
+ $ scp rc <user>@<server>:.ssh/
14
+ $ ssh <user>@<server>
15
+ ```

1

追記

2018/04/18 06:56

投稿

nullpon
nullpon

スコア5739

answer CHANGED
@@ -1,1 +1,4 @@
1
- つssh -t <your server> bash --noprofile -l -i
1
+ つssh -t <your server> bash --noprofile -l -i
2
+
3
+ 追記
4
+ つssh -t <your server> sudo -e /etc/profile.d/tomcat.sh