質問編集履歴
10
試したことの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -248,6 +248,18 @@
|
|
248
248
|
|
249
249
|
|
250
250
|
|
251
|
+
```
|
252
|
+
|
253
|
+
$ /usr/local/var/www/cgi-bin/test.py
|
254
|
+
|
255
|
+
/usr/local/var/www/cgi-bin/test.py: line 3: syntax error near unexpected token `'Content-Type: text/html\n\n''
|
256
|
+
|
257
|
+
/usr/local/var/www/cgi-bin/test.py: line 3: `print ('Content-Type: text/html\n\n')'
|
258
|
+
|
259
|
+
```
|
260
|
+
|
261
|
+
|
262
|
+
|
251
263
|
・lsコマンドの結果
|
252
264
|
|
253
265
|
```
|
9
試したことの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -178,6 +178,74 @@
|
|
178
178
|
|
179
179
|
```
|
180
180
|
|
181
|
+
```
|
182
|
+
|
183
|
+
$ su root
|
184
|
+
|
185
|
+
Password:
|
186
|
+
|
187
|
+
bash-3.2# chsh -s /bin/bash www
|
188
|
+
|
189
|
+
Changing shell for _www.
|
190
|
+
|
191
|
+
bash-3.2# su www
|
192
|
+
|
193
|
+
bash-3.2$ id
|
194
|
+
|
195
|
+
uid=70(_www) gid=70(_www) groups=70(_www),12(everyone),61(localaccounts),100(_lpoperator),701(com.apple.sharepoint.group.1)
|
196
|
+
|
197
|
+
bash-3.2$ cat /Users/(user)/.pyenv/shims/python
|
198
|
+
|
199
|
+
#!/usr/bin/env bash
|
200
|
+
|
201
|
+
set -e
|
202
|
+
|
203
|
+
[ -n "$PYENV_DEBUG" ] && set -x
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
program="${0##*/}"
|
208
|
+
|
209
|
+
if [[ "$program" = "python"* ]]; then
|
210
|
+
|
211
|
+
for arg; do
|
212
|
+
|
213
|
+
case "$arg" in
|
214
|
+
|
215
|
+
-c* | -- ) break ;;
|
216
|
+
|
217
|
+
*/* )
|
218
|
+
|
219
|
+
if [ -f "$arg" ]; then
|
220
|
+
|
221
|
+
export PYENV_FILE_ARG="$arg"
|
222
|
+
|
223
|
+
break
|
224
|
+
|
225
|
+
fi
|
226
|
+
|
227
|
+
;;
|
228
|
+
|
229
|
+
esac
|
230
|
+
|
231
|
+
done
|
232
|
+
|
233
|
+
fi
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
export PYENV_ROOT="/Users/(user)/.pyenv"
|
238
|
+
|
239
|
+
exec "/Users/(user)/.pyenv/libexec/pyenv" exec "$program" "$@"
|
240
|
+
|
241
|
+
bash-3.2$ /Users/(user)/.pyenv/shims/python -V
|
242
|
+
|
243
|
+
Python 3.6.5
|
244
|
+
|
245
|
+
bash-3.2$
|
246
|
+
|
247
|
+
```
|
248
|
+
|
181
249
|
|
182
250
|
|
183
251
|
・lsコマンドの結果
|
8
su www実行時の内容の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -162,6 +162,22 @@
|
|
162
162
|
|
163
163
|
```
|
164
164
|
|
165
|
+
```
|
166
|
+
|
167
|
+
$ su root
|
168
|
+
|
169
|
+
Password:
|
170
|
+
|
171
|
+
sh-3.2# su www -s /bin/sh
|
172
|
+
|
173
|
+
sh-3.2# /Users/(ユーザー)/.pyenv/shims/python -V
|
174
|
+
|
175
|
+
Python 3.6.5
|
176
|
+
|
177
|
+
sh-3.2#
|
178
|
+
|
179
|
+
```
|
180
|
+
|
165
181
|
|
166
182
|
|
167
183
|
・lsコマンドの結果
|
7
su www -s /bin/sh 追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -140,6 +140,28 @@
|
|
140
140
|
|
141
141
|
```
|
142
142
|
|
143
|
+
```
|
144
|
+
|
145
|
+
$ su root
|
146
|
+
|
147
|
+
Password:
|
148
|
+
|
149
|
+
sh-3.2# su www -s /bin/sh
|
150
|
+
|
151
|
+
sh-3.2# id
|
152
|
+
|
153
|
+
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),701(com.apple.sharepoint.group.1)
|
154
|
+
|
155
|
+
sh-3.2# /usr/local/var/www/cgi-bin/test.py
|
156
|
+
|
157
|
+
/usr/local/var/www/cgi-bin/test.py: line 3: syntax error near unexpected token `'Content-Type: text/html\n\n''
|
158
|
+
|
159
|
+
/usr/local/var/www/cgi-bin/test.py: line 3: `print ('Content-Type: text/html\n\n')'
|
160
|
+
|
161
|
+
sh-3.2#
|
162
|
+
|
163
|
+
```
|
164
|
+
|
143
165
|
|
144
166
|
|
145
167
|
・lsコマンドの結果
|
6
lsコマンドの結果追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -134,8 +134,24 @@
|
|
134
134
|
|
135
135
|
Password:
|
136
136
|
|
137
|
-
sh-3.2# su www -s
|
137
|
+
sh-3.2# su www -s /usr/local/var/www/cgi-bin/test.py
|
138
138
|
|
139
139
|
sh-3.2#
|
140
140
|
|
141
141
|
```
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
・lsコマンドの結果
|
146
|
+
|
147
|
+
```
|
148
|
+
|
149
|
+
drwxr-xr-x+ 32 (ユーザー名) staff 1024 7 5 13:29 /Users/(ユーザー名)
|
150
|
+
|
151
|
+
drwxr-xr-x 26 (ユーザー名) staff 832 7 2 21:23 /Users/(ユーザー名)/.pyenv
|
152
|
+
|
153
|
+
drwxr-xr-x 31 (ユーザー名) staff 992 7 5 14:28 /Users/(ユーザー名)/.pyenv/shims/
|
154
|
+
|
155
|
+
-rwxr-xr-x@ 1 (ユーザー名) staff 422 6 9 19:59 /Users/(ユーザー名)/.pyenv/shims/python
|
156
|
+
|
157
|
+
```
|
5
su www実行時の内容の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -127,3 +127,15 @@
|
|
127
127
|
Hello world!
|
128
128
|
|
129
129
|
```
|
130
|
+
|
131
|
+
```
|
132
|
+
|
133
|
+
$ su root
|
134
|
+
|
135
|
+
Password:
|
136
|
+
|
137
|
+
sh-3.2# su www -s su /usr/local/var/www/cgi-bin/test.py
|
138
|
+
|
139
|
+
sh-3.2#
|
140
|
+
|
141
|
+
```
|
4
su www実行時の内容の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -97,3 +97,33 @@
|
|
97
97
|
・ScriptAriasの設定
|
98
98
|
|
99
99
|
ScriptAlias /cgi-bin/ "/usr/local/var/www/cgi-bin/"
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
・su www実行時の内容
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
```
|
108
|
+
|
109
|
+
$ su root
|
110
|
+
|
111
|
+
Password:
|
112
|
+
|
113
|
+
sh-3.2# su www
|
114
|
+
|
115
|
+
sh-3.2# id
|
116
|
+
|
117
|
+
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),701(com.apple.sharepoint.group.1)
|
118
|
+
|
119
|
+
sh-3.2# python test.py
|
120
|
+
|
121
|
+
Content-Type: text/html
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
Hello world!
|
128
|
+
|
129
|
+
```
|
3
試したことの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -91,3 +91,9 @@
|
|
91
91
|
|
92
92
|
|
93
93
|
太字部分を追加致しました。
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
・ScriptAriasの設定
|
98
|
+
|
99
|
+
ScriptAlias /cgi-bin/ "/usr/local/var/www/cgi-bin/"
|
2
タイトルの変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Apacheでlocalhost:8080/cgi-bin/test.pyが表示されない
|
1
|
+
Apacheでlocalhost:8080/cgi-bin/test.pyがInternal Server Errorとなり表示されない
|
test
CHANGED
File without changes
|
1
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,9 +26,9 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
print 'Content-Type: text/html\n\n'
|
29
|
+
print ('Content-Type: text/html\n\n')
|
30
30
|
|
31
|
-
print "Hello world!"
|
31
|
+
print ("Hello world!")
|
32
32
|
|
33
33
|
```
|
34
34
|
|