How to access file system with adb shell for the work profile - adb

With the command "adb shell ls", only the files for the private user are listed. How to access the files for the work profiles? There is no argument to specify the user, like the am command has.

Related

command line of process without admin permission in windows

I want to get command line of a process without admin permission.
I tried
WMIC PROCESS WHERE "NAME='NAME.EXE'" GET COMMANDLINE
But I can't get anything, all I did needs admin right.
How can I get process command-line without no permission, not using C#?
Is there another way to get process command line, not using wmi, C#, powerShell?

How to assign a keyboard shortcut to a bat file that restarts a service?

I'd like to know if it's possible to assign a keyboard shortcut to run a bat file as administrator, without using any software.
you can do this only over a shortcut.Check shortcutJS.bat.It can create a shortcut from command line and set admin permissions and
call shortcutJS.bat -linkfile "serv.lnk" -target "%cd%\serv.bat" -hotkey "ALT+CTRL+S" -adminpermissions yes
where the serv.bat is the bat you want to execute and is in the same directory (creation of the shortcut requires full path).
Create a shortcut to your script on the desktop and set a shortcut key for the shortcut using standard properties window.
If you need administrator's privileges, you may create a wrapper script like this:
runas /user:Administrator your_original_script.bat
and point the shortcut to it instead.

open() device in /dev folder

I am writing a kernel module. I have a utility provided by the course staff, which is ran by web2py at the browser windows. The utility tries to access character devices at /dev folder, by calling open function (the utility is written in python)and gets "permission is denied" error.
I read that it is possible to run browser as a root but is depricated.
Is there a way to set permissions for the devices thru the code?
Or I have to do it manualy each time
There are several ways to set permissions:
1) have a boot script (or the script that loads the module) set the permissions
2) write a udev rule that sets the owner/permissions when the device is created. The author of the kernel module can tell you how to setup the udev rules.
It's more secure to use chown to set the owner to your web user, than to use chmod and open the file up to anybody.

setting a program as my login shell

Can I set a small program that I wrote as my login shell? Instead of a regular login shell like bash? I tried googling but could not find any useful information. Any pointer is appreciated.
chsh -s /usr/bin/foo someuser
Or use vipw to edit /etc/passwd (just don't edit it directly).
Yes, you can change the login shell executable with the command chsh (change shell) or by manually editing the /etc/passwd file (the last value on the line is the login shell).
Editing the /etc/password file manually is discouraged, as 1) it requires root permission 2) the user base might not be local, but distributed using NIS, LDAP etc. and thus this will not work 3) chsh should work also in the case of a distributed user base.
As the question addresses unices, Solaris does not have this command and the only way you can mimic this behavior (without root access for which you can use passwd -e) is by executing the other shell from your .profile file.
Also, keep in mind that the custom shell binary must be present in /etc/shells, otherwise it will not work.

I created my own Linux shell but get "mctrl: Permission denied" on login?

I have a tiny shell in C which does nothing but print "Hello, im a shell\n".
Everytime I try to login johndoe the default way i get Login failed, and using sudo su johndoe gives me exactly mctrl: Permission denied.
Am i missing something simple? What does bash have which i dont =( ?
Update1: I forgot to specify the absolute path naming the shell. however the error still occours.
Updatate2[solved]: No links are allowed for shells, and should be in /bin/ or some other directory with respect!
PS: The shell will be given users to control their minecraft servres in a simple way through ssh, or give adminstration password to get into bash.
The first thing that I would check would be file and directory permissions. Does johndoe have access to the shell executable (and all its parent directories), and is the "execute" permission set correctly?
If you change johndoe's shell to bash, are you able to log in as johndoe and manually execute your custom shell?

Resources