grant new user write permission for EC2 instance - amazon-ec2

i added a new user "developer" to my EC2 so that he can access my /var/www/html via ftp. but when "developer" tried uploading files to the directory, he's not allowed. how do i grant this user write permission?

Try to add your user to the group www-data and set 775 permissions in the folder.

Related

Laravel storage in Laradock, how to make directory as Laradock user and not as root?

In Laravel I use the makeDirectory() method to create a new directory, whenever necessary, like so:
Storage::disk($disk_name)->makeDirectory($subfolder, 0755, true, true);
However, in the Laradock workspace container, the new directory is created with root:root as owner. Since I am using the laradock:laradock user, I get errors, such as permission denied, when using other functions, such as \ZipArchive::CREATE static method.
How do I fix to tell Laradock to create new directory with the laradock:laradock user as the owner and not root:root as the owner?
.env
Inside the main .env file, in the workspace section, I got the following:
WORKSPACE_PUID=1000
WORKSPACE_PGID=1000
And, inside the workspace container, with --user=laradock, when asking:
$ id
uid=1000(laradock) gid=1000(laradock) groups=1000(laradock)
I get the exact same id for user Laradock.
So why is the root:root the owner of the newly created directory by the Laravel Storage::makeDirectory() static function, instead of Laradock?
How do I fix it? What am I missing? Is there any workaround?

How to solve the problem of accessing the storage in Laravel folder

Faced a problem accessing the storage folder. A symbolic link was created, but when I try to access any file in the storage folder, I get an error 403 "You do not have permission to access this object. The file is not readable, or the server cannot read it." I have a second project on a local machine, everything works fine there. I tried to give 777 permissions to the storage folder, but this causes the "Permisson denied" error. I will be glad to any help!
Macos catalina
Laravel Permissions
first change ownership of the laravel directory to our web group.
sudo chown -R :www-data /var/www/laravel
Next we need to give the web group write privileges over our storage directory so it can write to this folder.
sudo chmod -R 775 /var/www/laravel/storage
where laravel is the name of the root

How can I give my EC2-User permission to deploy java code on AWS EC2

I want to deploy my spring boot application to EC2.
I am using scp command to copy my jar to ec2 var folder,but I get permission denied.
I checked and found that this folder has access to root user only.
Also when I am logged in as ec2-user,I dont have rights to create new folder.
Can you please suggest how as a ec2-user,code can be deployed to Ec2 instance.
Since you are logging in as ec2-user, I am assuming that you are using one of the aws managed Linux AMI. In these AMIs ec2-user can run commands as root, simply run command as sudo.
Eg: sudo mkdir test
You can also switch to root user by using sudo -su root
Please find below link to aws doc for user management
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html

EC2 AMI instance is resetting folder permission everyday

I have a log folder /var/www/app/logs/ in an EC2 AMI instance. My PHP aplication is writing logs there, however every day I must logon and do chmod in order to avoid the error message that the folder is not writable:
$ sudo chmod 7777 -R /var/www/app/logs/
For some reason the instance this permissions are reset every morning automatically by some unknown process. Is there a way to make this change permanently?
My guess is that you have some log rotation rules set up for this directory, which might be responsible for the permission change.
And, don't set the permissions to 777, definitely. Either change the owner of the directory to your application user, or add your application user to a group which has write permission to the directory.
Not sure whether is the best solution, but solves my problem. Edit the /etc/httpd/conf/httpd.conf file and change:
User apache
By:
User ec2-user
Then restart the webserver.

Can't open macOS App. What does the + symbol represent in permissions?

I am working in terminal on macOS. I have a macOS App with permissions:
drwxr-xr-x+ 3 root admin
What does the + at the end mean?
There are similar questions to this for other environments.
I can't launch the App. I get this error.
LSOpenURLsWithRole() failed with error -10810 for the file /path/to/file
EDIT1: I have several user accounts setup. I have used chown to change from userA to root. I hoped this would allow any user to open the App. If I login to 'userA' account, I can launch the App, but if I use any other user account, I get the above error. What the jellybeans is going on ???
Edit2: I deleted the App from userA and re-downloaded / installed using userB. userB can launch the app just fine but userA cannot (same error). The user:group is slightly different this time though (notice the '+' isn't there by default this time.
drwxr-xr-x 3 userB staff
Performing sudo chown root /path/to/file changed the permissions to
drwxr-xr-x 3 root staff
This made no change i.e. userB can launch and userA cannot.
if you can see + in the file permission then ACL is setup on the file. It means a special permission has set on the file which allow owner of the file to provide the access to individual. You need to ask to owner of the file to execute below command then you will be able to execute the script/program/app.
setfacl -m u:youruserid:rwx file.txt
to know more about ACL, check here.
I Never get the chance to set ACL on mac file but I believe it will work same as it work in GNU/Linux.

Resources