gpt4 book ai didi

tomcat - 如何在 Amazon EC2 中为 Tomcat 上传库

转载 作者:行者123 更新时间:2023-11-28 21:51:33 25 4
gpt4 key购买 nike

我需要将一个库上传到我的 Tomcat 文件夹(在 EC2 实例中)。我一直做的是:

scp -r -i /home/path_to_key/key.pem /home/path_to_file/file.jar  ec2-user@my_address.compute.amazonaws.com:/home/ec2-user

如果我在“用户”文件夹(或其子文件夹)中上传文件,这会起作用。如果我想上传/opt/tomcat7/lib/中的文件怎么办?我收到此错误:

scp: /opt/tomcat7/lib/file.jar: Permission denied

谁能帮帮我?谢谢,安德里亚·内格里

编辑:

totale 140
drwxr-xr-x 10 tomcat7 tomcat7 4096 17 lug 00:30 .
drwxr-xr-x 5 root root 4096 6 gen 2012 ..
-rw-r--r-- 1 tomcat7 tomcat7 18 28 lug 2011 .bash_logout
-rw-r--r-- 1 tomcat7 tomcat7 176 28 lug 2011 .bash_profile
-rw-r--r-- 1 tomcat7 tomcat7 124 28 lug 2011 .bashrc
drwxr-xr-x 2 tomcat7 tomcat7 4096 17 lug 00:30 bin
drwxr-xr-x 3 tomcat7 tomcat7 4096 18 ago 15:35 conf
drwxr-xr-x 2 tomcat7 tomcat7 4096 17 lug 00:30 endorsed
-rw-r--r-- 1 tomcat7 tomcat7 121 28 lug 2011 .kshrc
drwxr-xr-x 2 tomcat7 tomcat7 4096 17 lug 00:30 lib
-rw-r--r-- 1 tomcat7 tomcat7 56797 20 nov 2011 LICENSE
drwxrwxr-x 2 tomcat7 elasticbeanstalk 4096 18 ago 18:01 logs
-rw-r--r-- 1 tomcat7 tomcat7 1192 20 nov 2011 NOTICE
-rw-r--r-- 1 tomcat7 tomcat7 8824 20 nov 2011 RELEASE-NOTES
-rw-r--r-- 1 tomcat7 tomcat7 10597 20 nov 2011 RUNNING.txt
drwxr-xr-x 2 tomcat7 tomcat7 4096 17 lug 00:30 temp
drwxr-xr-x 3 tomcat7 tomcat7 4096 18 ago 15:39 webapps
drwxr-xr-x 3 tomcat7 tomcat7 4096 18 ago 15:35 work

最佳答案

您需要设置适当的权限,以便 ec2-user 可以写入目标目录。如果您发布这两个命令的输出,我会尽力帮助您:

id
sudo ls -al /opt/tomcat7

编辑:根据您的输出,我认为正确的做法是将 ec2-user 添加到“tomcat7”组,然后授予该组对目录的写入权限:

sudo usermod -a -G tomcat7 ec2-user
sudo chmod -R g+w /opt/tomcat7

关于tomcat - 如何在 Amazon EC2 中为 Tomcat 上传库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12020622/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com