su

How do you start Python Paramiko SFTP with sudo?

半腔热情 提交于 2020-02-02 08:58:26
问题 Using the standard client.open_sftp() handle gives me SFTP controls but without sudo/root permissions, any sort of /etc/** files can't be edited. I have a user that has passwordless sudo access, I figured I could maybe start off with sudo su and then invoke SFTP but that did not seem to be the case. t = paramiko.Transport(('192.168.56.102', 22)) t.connect(username='vagrant', password='vagrant') chan = t.open_session() chan.get_pty() chan.invoke_subsystem('sftp') chan.exec_command('sudo su')

How do you start Python Paramiko SFTP with sudo?

感情迁移 提交于 2020-02-02 08:54:13
问题 Using the standard client.open_sftp() handle gives me SFTP controls but without sudo/root permissions, any sort of /etc/** files can't be edited. I have a user that has passwordless sudo access, I figured I could maybe start off with sudo su and then invoke SFTP but that did not seem to be the case. t = paramiko.Transport(('192.168.56.102', 22)) t.connect(username='vagrant', password='vagrant') chan = t.open_session() chan.get_pty() chan.invoke_subsystem('sftp') chan.exec_command('sudo su')

Execute shell commands and get output in a TextView

徘徊边缘 提交于 2020-01-22 15:05:47
问题 I want to execute some shell commands and get the output in a TextView . The command may have a continuous output like ping or logcat . Also, the TextView should scroll automatically as the command output is added in real-time. In order to do so, I have done this: package com.example.rootapp; import java.io.DataOutputStream; import java.io.InputStream; import android.app.Activity; import android.os.Bundle; import android.text.method.ScrollingMovementMethod; import android.widget.TextView;

Execute shell commands and get output in a TextView

可紊 提交于 2020-01-22 15:04:26
问题 I want to execute some shell commands and get the output in a TextView . The command may have a continuous output like ping or logcat . Also, the TextView should scroll automatically as the command output is added in real-time. In order to do so, I have done this: package com.example.rootapp; import java.io.DataOutputStream; import java.io.InputStream; import android.app.Activity; import android.os.Bundle; import android.text.method.ScrollingMovementMethod; import android.widget.TextView;

getting error while using “su” command

大城市里の小女人 提交于 2020-01-12 18:45:28
问题 I try to make batch file to run adb commands. I want to use su -c , but I get the error: su: invalid uid/gid '-c'. I saw somewhere that my su version doesn't support -c , how can I enable this? 回答1: In batch file it should be like this: adb shell "su 0 <command args>" For example: adb shell "su 0 mount -o rw,remount /system" 回答2: The standard Android su is much simpler than its regular linux counterpart. It does not support any commands other than -c - so it's become redundant. usage: su [UID

getting error while using “su” command

点点圈 提交于 2020-01-12 18:44:09
问题 I try to make batch file to run adb commands. I want to use su -c , but I get the error: su: invalid uid/gid '-c'. I saw somewhere that my su version doesn't support -c , how can I enable this? 回答1: In batch file it should be like this: adb shell "su 0 <command args>" For example: adb shell "su 0 mount -o rw,remount /system" 回答2: The standard Android su is much simpler than its regular linux counterpart. It does not support any commands other than -c - so it's become redundant. usage: su [UID

Working Directory : null environment when running Process.Builder on android

蓝咒 提交于 2020-01-11 12:44:28
问题 I am using two phones, Galaxy Nexus(JellyBean) and Nexus 5(KitKat). I am trying to execute a script which exists in /data/folder/scripts/run.sh I use Process.Builder to build the command. This command is built by getting Environment.getDataDirectory().toString() + "/folder/scripts/run.sh" There are no issues running this on the Galaxy Nexus but when I run it on the Nexus 5, I catch an exception when I run the process.start(). The output which I get contains: Error running exec(). Command: [

Understanding SU request

强颜欢笑 提交于 2020-01-06 07:25:33
问题 My app needs to request SU access (on rooted devices) and the only examples out there say to do this: Process p = null; p = Runtime.getRuntime().exec("su"); That's fine, but how do I associate that p process with what I want to do next? For example how do I use that process to open a database so that the attempt to open the database happens with root permissions? 回答1: Please see this discussion: Run secure API calls as root, android Basically, you'd have to specify the stuff you want to

How can I execute “su” on Android?

孤街醉人 提交于 2020-01-04 02:03:07
问题 process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(command + "\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); The system says: "07-06 11:01:34.337: I/System.out(3864): su: uid 10170 not allowed to su" I execute "adb root" in my terminal :~/android/android-sdk/platform-tools$ ./adb root adbd is already running as root Any ideas? 回答1: It looks like your adb is running as root, but you only have the stock 'su' tool. You

How to run script as another user without password?

柔情痞子 提交于 2019-12-27 10:30:02
问题 I have script.sh that must be run as user2. However, this script can only be run under user1 in my application. I would like the following command to run: su user2 -C script.sh but be able to run without password. I also want this to be very restrictive, as in user1 can only run script.sh under user2 and nothing else. I've tried doing this with sudoers file and just got endlessly confused after hours of trying. If somebody can provide an explicit example of how this can be accomplished