This tool must be run as root mac os ��������

Включение учетной записи пользователя root на компьютере Mac или изменение пароля root

Администраторы компьютеров Mac могут использовать учетную запись пользователя root для выполнения задач, требующих доступа к расширенному списку областей системы.

Пользователь root — это суперпользователь с привилегиями чтения и записи в дополнительных областях системы, включая файлы в учетных записях других пользователей macOS. По умолчанию пользователь root отключен. Если не удается войти в систему компьютера Mac с учетной записью администратора, включите пользователя root и выполните вход как пользователь root, чтобы выполнить свою задачу.

Учетная запись пользователя root не предназначена для повседневной работы. Ее привилегии позволяют вносить изменения в файлы, необходимые для работы компьютера Mac. Для отмены таких изменений может потребоваться переустановка системного ПО. После выполнения задачи пользователя root следует отключить.

Безопаснее использовать команду sudo в программе «Терминал» вместо включения пользователя root. Чтобы узнать о команде sudo , откройте программу «Терминал» и введите man sudo .

Включение и отключение учетной записи пользователя root

  1. Перейдите в меню Apple () > «Системные настройки» и откройте вкладку «Пользователи и группы» (или «Учетные записи»).
  2. Щелкните , затем введите имя и пароль администратора.
  3. Нажмите «Параметры входа».
  4. Нажмите «Подключить» (или «Изменить»).
  5. Нажмите «Открыть Службу каталогов».
  6. Щелкните в окне «Служба каталогов», затем введите имя и пароль администратора.
  7. Выполните следующие действия в строке меню «Службы каталогов»:
    • Выберите «Правка» > «Включить корневого пользователя» и введите пароль для пользователя root.
    • Или выберите «Правка» > «Отключить корневого пользователя».

Вход в систему в качестве пользователя root

Если пользователь root включен, его привилегии доступны только после входа в систему в качестве пользователя root.

  1. Перейдите в меню Apple > «Завершить сеанс», чтобы выйти из текущей учетной записи пользователя.
  2. В окне входа введите имя пользователя root и пароль, созданный для пользователя root.
    Если в окне входа отображается список пользователей, нажмите кнопку «Другой» и выполните вход.

Не забудьте отключить учетную запись пользователя root после выполнения задачи.

Источник

Run OS X apps as root

Aug 13, 2001 · 2 min read

If you’ve used Mac OS X’s command line at all, you may have already seen the sudo command. It lets you execute commands as root (also known as the super-user), which you may want to do periodically for various UNIX system administration tasks. However, sudo can also be used to run any Mac OS X application as root.

This can be very useful: For example, if you want to edit a system configuration file in TextEdit or BBEdit, you’ll have to do so as root or you won’t be able to save changes.

sudo’s b asic syntax is simple. Typing sudo myProcess at a command prompt runs myProcess as root. (If you haven’t used sudo in a while you’ll be prompted for your password first.)

You can run any app the same way, using sudo and the open command. Suppose you want to run the Chess application as root. Open Terminal (in Applications > Utilities) and at the command prompt, type:

sudo open «/Applications/Chess.app»

That’s it! You’re running Chess as root. A few things to note:

  • Some applications use the “ .app” extension shown above, while others do not. You can figure out whether an app uses this extension in Terminal. Use the cd command to change to the appropriate folder ( cd /Applications ). Then type ls to see the folder’s contents.
  • The quotation marks aren’t actually necessary in the example above. However, they are necessary if any part of the filename or path contains spaces. For example, without quotation marks “ /Applications/My Folder/My App ” will be interpreted by the command line as three items rather than one.
Читайте также:  Windows cmd batch syntax

The root user has unlimited power over the operating system. It’s relatively easy, with a few keystrokes, to erase massive amounts of data or render the system unusable. Letting root access fall into the wrong hands is, of course, also very dangerous. Every UNIX system administrator needs to become root from time to time, but you should always use extra caution, and only execute commands as root when absolutely necessary.

Источник

How to Run GUI Apps as root in Mac OS X

Those familiar with the command line know that running things with super user privileges is typically just a matter of using the sudo command. That still holds true with launching GUI apps into the OS X with root privileges, but it’s not just a matter of prepending sudo to the otherwise useful open command, because ‘open’ launches apps as the original user, with or without sudo. The solution instead is to use sudo pointing directly at the executable contained within a given applications package file.

Launching OS X GUI Apps as root user

The command syntax is as follows:

In most cases, that will be applications stored in the /Applications/ directory, and the executable is almost always stored in Package/Contents/MacOS/ as whatever the applications name is:

For example, this command runs the familiar TextEdit app as root:

To launch TextEdit as a background app, meaning it wont close if you close the terminal window, apply the -b flag to sudo:

sudo -b /Applications/TextEdit.app/Contents/MacOS/TextEdit

You can confirm the the application is running as root by using the ps command with grep, again using TextEdit as an example:

ps au|grep TextEdit

Alternatively, you can look at the OS X process management app Activity Monitor and find the application running there as ‘root’ user, as demonstrated in the screenshot up top and the short video below:

If you intend on running a particular app frequently as root, you might consider placing an alias in .bash_profile to shorten the command string.

Despite running as root, not all system files may be modifiable and some may be marked as “Locked” when opened in some apps like TextEdit. That issue can often be resolved by enabling the root user if you have’t done so yet, but not all apps will have that limitation. Nonetheless, for certain tasks like editing the hosts file you’re still better off sticking to the command line and a text based editor, or using an app like BBEdit or TextWrangler.

Источник

How to run a macOS app as root and use system calls?

I’m trying to run the setpriority command from my macOS app (objective-c). It never works and I’m assuming it is because the app is not being run as the root user.

  • I’m logged in to the admin account on my computer
  • I’ve tried opening the app with sudo
  • I’ve tried using chmod on the app
  • I’ve tried adding the app to the Accessibility list under Security and Privacy
Читайте также:  Virtualbox x64 для linux

Xcode version 9.2 (9C40b)

I would appreciate any help, thanks!

2 Answers 2

You want to run as root , or you want to run with sudo ? There’s a difference. Running as root is definitely not recommended, you will get strange behaviour from the system.

I’ve tried opening the app with sudo

That should work. How have you tried? You need to call the binary within the .app bundle. Running open against the bundle won’t work.

It’s not recommended to run GUI apps on macOS as root. Instead, you should factor out the part of your application which needs root access into a separate helper tool, launch that tool as root using the SMJobBless() function, and then communicate with the tool using XPC.

Apple provides the EvenBetterAuthorizationSample example code to give a pretty good basic framework to work from.

EDIT: I decided to make my own authorization sample project a while ago that should be a little easier to use than the venerable EvenBetterAuthorizationSample . You can check it out at CSAuthSample.

Источник

How to Enable the Root User on Mac

On macOS, certain parts of the file system are unavailable by default, even if you are the administrator. But if you enable the root user on your Mac, you’ll gain read and write privileges to the entire file system. You can even access files of another user’s account – perfect if you forget your username or password, or if an ex-employee leaves your business without sharing the login details for their company-issued laptop.

Also read: How to Enable or Disable Turbo Boost on Your Mac

By enabling root user, you’ll have full control over your Mac. While this can be handy for advanced users, it’s also far easier to damage your Mac. Apple is fully aware of this and has disabled root access by default. Follow along with this tutorial to learn how to enable the root user on macOS.

1. Enabling Root via the Terminal

You can enable root access via your Mac’s Terminal. To launch the Terminal, open a new Finder window and navigate to “Applications -> Utilities.”

In the Terminal window, type the following command

and press Enter. The Terminal should detect your username automatically and will then request your password.

Type your password and press Enter.

You’ll be prompted to create a password for the root account. Since the root user essentially has access to every part of your Mac, make sure you choose a strong password!

Once the process is complete, you should see the following message:

Root is now enabled on your laptop or computer, and you can start using it for tasks that would be impossible to complete via a regular user account.

Also read: How to Delete Files from Your Mac that Won’t Delete

2. Enabling Root using Directory Utility

If you prefer to use a GUI-based option, you can enable the root user on your Mac via the Directory Utility instead:

1. Open your Mac’s Spotlight by clicking the menu icon in the upper-right corner of the screen.

2. In the Spotlight window, search for “Directory Utility,” then select this application when it appears.

3. In Directory Utility, make sure the “Services” tab is selected.

4. In the bottom-left corner, click the little padlock icon and enter your username and password when prompted.

5. In the toolbar, select “Edit -> Enable Root User.”

6. When prompted, create a username and password for your root user.

Читайте также:  Аимп windows 10 64 bit

7. You can now click “OK” to create your root account.

If you want to disable the root user at any point, then relaunch the Directory Utility, but this time select “Edit -> Deactivate root user.”

How to log in to the root user account

Once it’s enabled, you can log in to the root account from macOS’s login screen:

1. Log out of your current account, as normal.

2. On macOS’s login screen, select “Other … ”

3. For “username,” enter “root.” You can now enter your root password.

4. Log in to the account. Congratulations – you’re now a root user!

This account may look exactly the same as a regular user account, but it’s now possible to access, edit and even delete files that would usually be strictly off-limits, so tread carefully!

To be on the safe side, you should only log in to the root account when you have a task that specifically requires root privileges.

Disabling Root User using Terminal

To help protect your Mac from malicious activities, or even accidental damage, you should disable root as soon as it’s no longer required.

To disable root access, launch your Mac’s Terminal (“Applications -> Utilities -> Terminal”), then run the following command:

When prompted, enter the password for your current account. You should see the following message.

The root user account is now disabled on your Mac.

Also read: How to Add and Remove Kexts from macOS

For Linux, you can follow this tutorial to disable the root user account. Do note that you won’t need the root account for most fixes. If you have a frozen Mac, here are some ways to fix it without requiring a root account.

Jessica Thornsby is a technical writer based in Derbyshire, UK. When she isn’t obsessing over all things tech, she enjoys researching her family tree, and spending far too much time with her house rabbits.

3 comments

A nice, clear way of showing how this is done. Many thanks!

Thanks for making this clear and easy for non tech people.

Enabling the root user is not needed to make some system-wide changes if your user account is an admin account. In fact, root user is not really disabled, just the ability to login directly as root is disabled. This is not exclusive to macOS, it is BSD-typical (and some Linux distros do too).

In Terminal you can enter `sudo -i`, then enter your password and you are root. Test it with `whoami`.

To change some config files in /private/etc/ you can use a “better” text editor like Sublime Text, e.g., which asks you for your password when saving, even without becoming root first.

Leave a Comment Cancel reply

RedMagic 6S Pro Review: Gaming Is Serious Business.

How to Fix Mac Wi-Fi Problems and Dropped Connections

5 Simple (Yet Cool) Drawing Apps for Mac

Camera Not Working or Available on Mac? Here’s How to Fix It

How to Run Android Apps on Mac

How to Install and Use wget on Mac

How to Delete Files from Your Mac that Won’t Delete

4 Ways to Create a New Blank Text File in Any Folder on Your Mac

How to Add and Remove Kexts from macOS

How to Play Animated GIFs on Your Mac

Need to Fix a Water-Damaged MacBook? Find Out How to Save It

Affiliate Disclosure: Make Tech Easier may earn commission on products purchased through our links, which supports the work we do for our readers.

Источник

Оцените статью