Search code examples
amazon-web-servicesamazon-ec2bitnami

EC2 - creating a new user that has access to same directory


I've setup an EC2 with "bitnami" that creates a linux user bitnami@myproject.com as a user for me to access with my keyfile.

Once signed in via ssh by doing ssh -i mykeyfile.pem bitnami@12.23.43.32 and hitting ls I get apps bitnami_credentials htdocs stack

I now want to create a new user that is also able to connect to this location. Therefore I read https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html

I did sudo adduser developer, created a keypair on the EC2 dashboard and by using keygen I created the public key for this user.

And … I'm able to connect to the server with ssh -i developer.pem developer@12.23.43.32 however this user does not see any files if I type ls -a. I only get . .. .bash_logout .bashrc .cache .profile .ssh

How can I make sure this new user also is able to work with the directories that "bitnami" has to work with?


Solution

  • Whenever you do ssh to instance, after login the user directory is set to its home directory. In your case, it should be /home/developer.

    To view directories that you see in bitnami user home directory you have to switch directory after login as developer.

    • run ssh -i mykeyfile.pem bitnami@12.23.43.32 after login type pwd or the path of the directory where you see apps bitnami_credentials htdocs stack, for example, it should be /home/bitnami.
    • Now log as developer ssh -i developer.pem developer@12.23.43.32 and now change your directory to the one that you got in first command. cd /home/bitnami

    If you see permission then you need to set permission. You can add developer user to bitnami. You can check for permission here and here