The sudo environment changes some of the variables, while some will be passed through from your shell. To show this, create a short script:. Some tools might not read environment variables and determine the user environment through different means.
This form of customizing login behavior in macOS is deprecated but still works as of LaunchAgents are the preferred method to run scripts or processes at login. More info here. If you find yourself building custom LaunchAgents and LaunchDaemons frequently, you need to check out outset. You have to be aware that running commands with sudo results in a different environment than when you run them directly. In most cases running a single command with sudo is sufficient. However, sometimes it can be convenient to have an interactive shell that runs with super user privileges.
When you run sudo -s it will invoke a new shell, running as root. The shell that is run is the default shell of your account. So when you have bash set as your shell the default on macOS you will get a bash shell running as root. Most other environment settings will remain the same:. Alternatively you can use sudo -i to invoke a root shell. In most cases sudo -s should serve well. However, when you want to avoid any customization you might have set in your user environment and work in more pristine environment then it is good to know sudo -i exists.
There is a different command which allows you to change the user: The main difference between these tools is how they verify if you are authorized to switch. When you run su without a username, it assumes root. But since logging in as root is disabled by default on macOS, it will fail.
- microsoft office 2008 for mac product key activation code;
- multiple lines in one cell excel mac.
- su password in terminal | MacRumors Forums;
- custom laptop decals for mac!
It asks for your credentials to verify you. You do not need the credentials of the other user, whether it is root or a different user. Don't set the root password unless you have to. Zimmerman Jul 21 '09 at 6: On newer sudo releases, sudo -i is the same as sudo su -.
Kamil Kisiel Kamil Kisiel 9, 7 36 Saurabh Barjatiya Saurabh Barjatiya 4, 1 23 The su program expects you to supply the password of the user you become. Using sudo is much better; it doesn't require shared passwords. Jonathan Leffler Jonathan Leffler 10 Based on my experience: What I did is create a second account "Administrator" admin that has admin privileges then su admin enter admin's password sudo su - enter admin's password and then the shell I'm in is root. In order to do this you have to be root already admin is not sufficient. People will recommend to use sudo actually.
Tolsadus Tolsadus 5 Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Ask Question. Whenever I try to issue su I get this: Sorry Needless to say, I'm entering the correct admin password which does work with sudo. Petruza Petruza 1, 5 20 It just has no password. FakeName This is the most hilarious backdoor! If you can run sudo su , what in the world is the point of disabling su then?api.vinylextras.com/manual-of-equine-lameness.php
macos - Why can't I run `su`? (and how should I do?) - Ask Different
KolobCanyon - The point isn't really to "disable su ", it's to prevent root login. By disallowing login as root , you prevent a bunch of possible security issues. Not allowing someone who can sudo to su is kind of silly. Basically, su just changes the current user-id, and executes a command a shell, if not specified. If the user-id is already 0 root , such as when executed with sudo , there's nothing for it to do, so it just executes the shell. You can get a similar effect by doing sudo bash. FakeName Still confused. What's the difference between logging in as root and running 'sudo su'?
Isn't it effectively the same level?
Demystifying `root` on macOS, Part 2 — The `sudo` Command
KolobCanyon - Nope. Basically, if you disable login , it means that if there is a vulnerability in the login process, a hacker cannot use it to get root directly. It's basically done as a defence-in-depth thing. Kyle Cronin Kyle Cronin The Apple Way tm is to use sudo to run commands that require elevated privileges, not to switch to a root shell and work from that.
- mac osx - su not working on mac os x? - Server Fault.
- font editor for mac os.
- Enable or disable the root user.
- su password in terminal.
- sudo su - sorry. What's wrong? - Apple Community?
Ian C. Fake Name:
Related mac os x su password sorry
Copyright 2019 - All Right Reserved