问题描述
我在挂载/mnt/my-mount
中具有连接到EFS的python(3.8)Lambda函数。
我想通过该函数运行bash脚本,所以我创建了另一个文件script.sh
。
这是python函数:
import json
import os
def lambda_handler(event,context):
os.system("sh script.sh")
和bash脚本script.sh
:
#!/bin/bash
touch hello.txt
,我收到以下错误消息:
cannot touch script.sh: Read-only file system
注意:
- 我可以使用python函数(f.write)创建文件。
- 如果我运行
os.system("chmod 777 a.sh")
,我将再次得到Read-Only file system
。 - 如果我使用
rc = subprocess.call("bash a.sh")
,我会得到No such file or directory: 'bash a.sh'
- EFS具有具有
1000:1000
权限的用户777
的访问点。