Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

equivalent of su in powershell

Tags:

powershell

Let's say I'm an administrator on a Windows7 box. I'd like to be able to run commands as other users without knowing their passwords. This is what happens on linux. If I'm root, I can 'su' to other accounts without providing any password and run commands in their own name.

like image 819
Arnaud Avatar asked Oct 04 '11 19:10

Arnaud


People also ask

What is su for PowerShell?

su (substitute user or switch user) allows changing the account associated with the current terminal. Where Normal user have to give password of the account he wants to change to, super user (root) can change to any ID he wants without giving password.

Is there a PowerShell equivalent of sudo?

Windows Powershell doesn't have sudo - some commands need to be run as an administrator and Powershell has no concept of that.

Is there a su in Windows?

Once added to the path, su command is available anywhere on your system. Open a CMD window and just type in su to open a new CMD window with elevated permissions. Similarly, the command with an extra argument will also work as it is.

How do I login as root user in PowerShell?

Step 1: Open the Command Prompt, and type the PowerShell as a command, then press Enter key. Step 2: Now, the command prompt will turn to Windows PowerShell. Step 3: Type the command start-process PowerShell -verb runas and press "enter" key. Step 4: It will bring up an elevated Windows PowerShell as an administrator.


1 Answers

su (substitute user or switch user) allows changing the account associated with the current terminal. Where Normal user have to give password of the account he wants to change to, super user (root) can change to any ID he wants without giving password.

sudo executes a command as another user but observes a set of constraints about which users can execute which commands as which other users (generally in a configuration file named /etc/sudoers, best editable by the command visudo). Unlike su, sudo authenticates users against their own password rather than that of the target user (to allow the delegation of specific commands to specific users on specific hosts without sharing passwords among them and while mitigating the risk of any unattended terminals).

On windows runas.exe allows a user to run a programs with different permissions than the user's current logon provides. But for this you have to provide credentials. Windows security does not allow an administrator to execute as another user without his credentials. Administrators can do what they want but not under certains limits without control(discretionary power)

Now once it's said, on Windows an administrator can take and give ownership of ressources and then do what he wants, but it's logged.

like image 124
JPBlanc Avatar answered Sep 26 '22 03:09

JPBlanc