You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Root user access

I enabled root user from my system preference but, when ever i try to access it from the terminal it ask for password which i provide.After which i get the command sh-3.2# and when i try to access my downloads it say access denial

does this command sh-3.2# means root ?

I am stock and I really need help.please

thank you

MacBook Pro 16″, macOS 10.15

Posted on Jul 11, 2020 1:36 AM

Reply
Question marked as Top-ranking reply

Posted on Jul 11, 2020 10:59 AM

Last login: Sat Jul 11 04:07:30 on ttys000

mariamswanu@Mariams-MacBook-Pro ~ % sudo su

Password:

sh-3.2# whoami

root

sh-3.2# 

This is what i got.

I am taking this udemy course and were asked to ssh into the command line to connect to the EC2 INSTANCE.which requires root access.


12 replies

Jul 11, 2020 5:19 AM in response to mariamsuan

mariamsuan wrote:

I enabled root user from my system preference but, when ever i try to access it from the terminal it ask for password which i provide.After which i get the command sh-3.2# and when i try to access my downloads it say access denial
does this command sh-3.2# means root ?
I am stock and I really need help.please
thank you


That is not a command, that is your shell


see what is returned when you enter the command, copy and paste:


whoami





Not sure why you need to be root to access your Downloads ?



About the root user - Apple Support


ref: Change Privacy preferences on Mac - Apple Support



Jul 12, 2020 11:28 AM in response to BobHarris

thank you for all your responses

i try them and this is what i got.

mariamswanu@Mariams-MacBook-Pro ~ % sudo

usage: sudo -h | -K | -k | -V

usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]

usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]

      [command]

usage: sudo [-AbEHknPS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout]

      [-u user] [VAR=value] [-i|-s] [<command>]

usage: sudo -e [-AknS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout]

      [-u user] file ...

mariamswanu@Mariams-MacBook-Pro ~ % sudo bash-i

Password:

sudo: bash-i: command not found

mariamswanu@Mariams-MacBook-Pro ~ % sudo-s

zsh: command not found: sudo-s

mariamswanu@Mariams-MacBook-Pro ~ % 

Jul 12, 2020 11:49 AM in response to BobHarris

bash-3.2# sudo -s

sh-3.2# pwd

/Users/mariamswanu

sh-3.2# 

sh-3.2# 

sh-3.2# sudo -s

sh-3.2# 

sh-3.2# exit

exit

sh-3.2# sudo

usage: sudo -h | -K | -k | -V

usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]

usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]

      [command]

usage: sudo [-AbEHknPS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout]

      [-u user] [VAR=value] [-i|-s] [<command>]

usage: sudo -e [-AknS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout]

      [-u user] file ...

sh-3.2# sudo -s

sh-3.2# 

it seams like it didnt work

Jul 12, 2020 12:01 PM in response to mariamsuan

In above usage, there is a space between the word 'sudo' and the dash options. Or in the case of 'bash' a space between 'bash' and -i


You are not comfortable with the command line. You should be VERY VERY careful using the 'sudo' command, as if you execute the wrong command as 'root' you can turn your Mac into an expensive "Door Stop".


Suggest you make good backups before you continue experimenting with the 'sudo' command to become the root account.

Jul 12, 2020 12:06 PM in response to mariamsuan

Since I'm not sure what you are trying to do with the 'sudo' command in the above examples, I do not know what you expect, such that you say it does not work.


What command does your instructor what you to execute in order to connect with "EC2 INSTANCE". So far I've just seen you become 'root' and then exit back to your normal self.


sudo su -  # spaces between 'sudo' and 'su' and '-'
Password: ...........
whoami # should say 'root'
command to connect with the EC2 INSTANCE

Jul 13, 2020 11:07 AM in response to mariamsuan

> I am taking this udemy course and were asked to ssh into the command line to connect to the EC2 INSTANCE.which requires root access.


TL;DR: The Udemy instructor is an idiot.


Reading between the lines here, and unless I'm mistaken you DO NOT NEED root access on your own machine.

It looks like you are trying to connect to the EC2 instance as root.


The instructions are stupidly telling you to first become root on your own machine, then (presumably) invoke the SSH connection - this will inherently use your current username (i.e. root) to attempt the login.


Instead, it is MUCH SAFER to remain in your standard user account on your own machine and override the login to EC2 by passing in the username you want to connect to as part of the connection parameters.

There are numerous ways of doing this. AWS usually uses private keys, so you may need to tweak the setup, but normally you can just:


> ssh root@my.ec2.hostname


or:


> ssh -l root my.ec2.hostname


(where 'my.ec2.hostname' is the name and/or IP address of your EC2 host). This will work regardless of your local user ID and (attempt to) connect to the remote server as root.

Root user access

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.