제대로 작동하고 오류를 출력하지 않는 설치 스크립트가 있지만 새로 설치된 패키지 중 하나를 사용하여 명령을 실행할 때 키 파일( )에 액세스할 수 있는 권한이 없다는 메시지가 표시됩니다 /home/test/.config/configstore/bower-github.json
.
그러나 다음을 사용하여 패키지를 설치할 때정밀한스크립트와 동일한 명령이지만 터미널(스크립트 외부)에서 수동으로 하나씩 실행하면 모든 것이 예상대로 작동하고 권한에 대한 불만이 없습니다.
권한 문제를 일으키는 스크립트는 무엇입니까?
시스템 메시지
Linux test 5.3.0-59-generic #53~18.04.1-Ubuntu SMP Thu Jun 4 14:58:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
스크립트를 실행하는 명령
bash adapt.sh
sudo bash adapt.sh
(새로 설치된 가상 머신에서 별도로 테스트했는데 결과는 동일했습니다)
스크립트
#!/bin/bash
LOG=~/adapt/LOG.txt
# Print description
echo
echo "Adapt installation for Ubuntu 18.04 LTS (Bionic Beaver)"
echo "### Supported until April 2023 ###"
sleep 2
echo
echo "The Adapt authoring tool, CLI and dependencies will be installed."
sleep 2
echo -n "Would you like to continue? [y/N] "
read input
echo
if [[ $input == "y" || $input == "Y" ]]; then
echo "Creating and moving to new Adapt directory ..."
sleep 2
mkdir ~/adapt
cd ~/adapt
touch LOG.txt
echo "Updating software package repos ..."
sudo apt-get update >> /dev/null 2>&1
echo "Installing Git ..."
sudo apt-get -y install git-all >> $LOG 2>&1
$(which curl >> /dev/null 2>&1)
if [ $? != 0 ]; then
sudo apt-get -y install curl >> $LOG 2>&1
fi
echo "Installing Node.js v12.x (LTS) ..."
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - >> $LOG 2>&1
sudo apt-get -y install nodejs >> $LOG 2>&1
echo "Installing Grunt ..."
sudo npm install -g grunt-cli >> $LOG 2>&1
echo "Installing the Adapt CLI ..."
sudo npm install -g adapt-cli >> $LOG 2>&1
echo "Installing MongoDB and starting mongod service ..."
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - >> $LOG 2>&1
sudo touch /etc/apt/sources.list.d/mongodb-org-4.2.list
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee -a /etc/apt/sources.list.d/mongodb-org-4.2.list >> /dev/null 2>&1
sudo apt-get update >> /dev/null 2>&1
sudo apt-get -y install mongodb-org >> $LOG 2>&1
sudo service mongod start >> $LOG 2>&1
echo "Installing the Adapt authoring tool ..."
git clone https://github.com/adaptlearning/adapt_authoring.git >> $LOG 2>&1
cd adapt_authoring
sudo npm install --production >> $LOG 2>&1
sudo node install
else
echo "Exiting..."
fi
echo "Refer to 'LOG.txt' for more information."
echo
실수
test@test:~/adapt$ adapt create course
/usr/lib/node_modules/adapt-cli/node_modules/bower/lib/node_modules/configstore/index.js:54
throw err;
^
Error: EACCES: permission denied, open '/home/test/.config/configstore/bower-github.json'
You don't have access to this file.
at Object.openSync (fs.js:458:3)
at Object.readFileSync (fs.js:360:35)
at Configstore.get (/usr/lib/node_modules/adapt-cli/node_modules/bower/lib/node_modules/configstore/index.js:35:26)
at new Configstore (/usr/lib/node_modules/adapt-cli/node_modules/bower/lib/node_modules/configstore/index.js:28:45)
at readCachedConfig (/usr/lib/node_modules/adapt-cli/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/lib/node_modules/adapt-cli/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/usr/lib/node_modules/adapt-cli/node_modules/bower/lib/index.js:16:32)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/home/test/.config/configstore/bower-github.json'
}
답변1
소유권을 변경해 보셨나요..
chown test.test /home/test/.config/configstore/bower-github.json