Reputation: 8330
I'm new to AWS and EC2.
I just added a new EBS volume to my EC2 instance. I formatted and mounted it using instructions from another SO answer.
When I try to access the new volume I have permissions issues. cd /vol
gives me
-bash: cd: /vol: Permission denied
Does anyone know why I can't cd
into the new volume?
In case it's relevant, ls -l /vol
gives me
ls: cannot access /data/lost+found: Permission denied
total 0
d????????? ? ? ? ? ? lost+found
. sudo ls -l /vol
returns
total 16
drwx------ 2 root root 16384 Sep 12 22:14 lost+found
What am I doing wrong?
Upvotes: 12
Views: 16058
Reputation: 149
you need to change owner of the EBS volume.
Say you mounted the new EBS volume to xvdf_mountpoint
folder.
first run whoami
to get your account name
then switch to root: su root
type in the password. if password not set: https://aws.amazon.com/premiumsupport/knowledge-center/set-change-root-linux/
chown [account name] /dev/xvdf
then su [account name]
,then you have complete access to the newly mounted EBS volume.
Upvotes: 5
Reputation: 5010
you need to have rights to access the volume.
You may also take ownership of the volume, by doing in the console:
sudo chown `whoami` /vol
you may also change the rights with chmod. You may check documentation on chown and chmod linux commands.
Upvotes: 34