如何上传为Tomcat在Amazon EC2上一个lib [英] How to upload a lib for Tomcat in Amazon EC2

查看:112
本文介绍了如何上传为Tomcat在Amazon EC2上一个lib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  SCP -r -i /home/path_to_key/key.pem /home/path_to_file/file.jar ec2-user@my_address.compute.amazonaws.com:/家庭/ ec2-用户
 

这工作,如果我上传文件中的用户文件夹(或子文件夹)。如果我想上传到/ opt / tomcat7 / lib目录/文件?我收到此错误:

  SCP:/opt/tomcat7/lib/file.jar:权限被拒绝
 

任何人都可以帮我吗?谢谢, 安德烈·内格里

编辑:

 驻颜140
drwxr-XR-X 10 tomcat7 tomcat7 4096 17挑着00:30。
drwxr-XR-×5根4096根6根2012 ..
-rw-R  -  R-- 1 tomcat7 tomcat7 18 28挑着2011 .bash_logout中
-rw-R  -  R-- 1 tomcat7 tomcat7 176 28挑着2011 .bash_profile中
-rw-R  -  R-- 1 tomcat7 tomcat7 124 28挑着2011的.bashrc
drwxr-XR-X 2 tomcat7 tomcat7 4096 17挑着00:30斌
drwxr-XR-X 3 tomcat7 tomcat7 4096 18前15:35的conf
drwxr-XR-X 2 tomcat7 tomcat7 4096 17挑着00:30赞同
-rw-R  -  R-- 1 tomcat7 tomcat7 121 28挑着2011 .kshrc
drwxr-XR-X 2 tomcat7 tomcat7 4096 17挑着00:30 LIB
-rw-R  -  R-- 1 tomcat7 tomcat7 56797 2011年11月20日许可
drwxrwxr-X 2 tomcat7 elasticbeanstalk 4096 18前18:01日志
-rw-R  -  R-- 1 tomcat7 tomcat7 1192二零一一年十一月二十日公告
-rw-R  -  R-- 1 tomcat7 tomcat7 8824二零一一年十一月二十日RELEASE-NOTES
-rw-R  -  R-- 1 tomcat7 tomcat7 10597 2011年11月20日RUNNING.txt
drwxr-XR-X 2 tomcat7 tomcat7 4096 17挑着00:30温度
drwxr-XR-X 3 tomcat7 tomcat7 4096 18前15:39的webapps
drwxr-XR-X 3 tomcat7 tomcat7 4096 18前15:35工作
 

解决方案

您需要设置适当的权限,所以EC2,用户可以写入到目标目录。如果您发布这两个命令的输出,我会尽力帮助你:

  ID
须藤LS -al /选择/ tomcat7
 

编辑:根据你的输出,我认为正确的做法是将EC2的用户添加到tomcat7组中,然后授予该组写访问的目录:

 须藤usermod命令-a -G tomcat7 EC2用户
sudo的文件模式-R G + W / OPT / tomcat7
 

I need to upload a lib to my Tomcat folder (in an EC2 instance). What I've always done is:

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

This works if I upload files in the "user" folder (or its subfolders). What if i want to upload a file in /opt/tomcat7/lib/ ? I receive this error:

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

Anyone can help me? Thanks, Andrea Negri

EDIT:

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

解决方案

You need to set the proper privileges so the ec2-user can write to the target directory. If you post the output of these two commands, I will try to help you:

id
sudo ls -al /opt/tomcat7

Edit: Based on your output, I think the proper thing to do would be to add the ec2-user to the "tomcat7" group, then grant that group write access to the directory:

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

这篇关于如何上传为Tomcat在Amazon EC2上一个lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆