回答編集履歴

6

訂正

2018/04/18 09:31

投稿

nullpon
nullpon

スコア5737

test CHANGED
@@ -34,6 +34,8 @@
34
34
 
35
35
  追記2.5
36
36
 
37
+ ```bash
38
+
37
39
  $ cat rc
38
40
 
39
41
  [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/

5

追記2.5

2018/04/18 09:31

投稿

nullpon
nullpon

スコア5737

test CHANGED
@@ -1,10 +1,10 @@
1
- つssh -t <user>@<server> bash --noprofile -l -i
1
+ つssh -t <your server> bash --noprofile -l -i
2
2
 
3
3
 
4
4
 
5
- 追記
5
+ 追記1
6
6
 
7
- つssh -t <user>@<server> sudo -e /etc/profile.d/tomcat.sh
7
+ つssh -t <your server> sudo -e /etc/profile.d/tomcat.sh
8
8
 
9
9
 
10
10
 
@@ -24,9 +24,35 @@
24
24
 
25
25
 
26
26
 
27
- $ scp rc <user>@<server>:.ssh/
27
+ $ scp rc <your server> :.ssh/
28
28
 
29
- $ ssh <user>@<server>
29
+ $ ssh <your server>
30
+
31
+ ```
32
+
33
+
34
+
35
+ 追記2.5
36
+
37
+ $ cat rc
38
+
39
+ [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/
40
+
41
+ $ sftp <your server>
42
+
43
+ sftp> cd .ssh
44
+
45
+ sftp> put rc
46
+
47
+ Uploading rc to /home/<user>/.ssh/rc
48
+
49
+ rc 100% 94 71.8KB/s 00:00
50
+
51
+ sftp> quit
52
+
53
+
54
+
55
+ $ ssh <your server>
30
56
 
31
57
  ```
32
58
 

4

追記3

2018/04/18 09:30

投稿

nullpon
nullpon

スコア5737

test CHANGED
@@ -29,3 +29,11 @@
29
29
  $ ssh <user>@<server>
30
30
 
31
31
  ```
32
+
33
+
34
+
35
+ 追記3
36
+
37
+ シングルユーザーモードを試して下さい。
38
+
39
+ つ[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

スコア5737

test CHANGED
@@ -16,6 +16,8 @@
16
16
 
17
17
  ```bash
18
18
 
19
+ $ echo '[[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/' > rc
20
+
19
21
  $ cat rc
20
22
 
21
23
  [[ -f /etc/profile.d/tomcat.sh ]] && sudo mv -f /etc/profile.d/tomcat.sh ~/

2

追記2

2018/04/18 08:14

投稿

nullpon
nullpon

スコア5737

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

1

追記

2018/04/18 06:56

投稿

nullpon
nullpon

スコア5737

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