Android uses chroot to run Linux and cannot use sudo

The tips of using sudo in the chroot Linux system in Android are as follows:

 sudo 必须属于用户 ID 0(的用户)并且设置 setuid 位

Solution:
1. Use the suid option to remount /data

busybox mount -o remount,suid /data

2. Put the entire rootfs into an img file, and then mount it
3. Use the root user directly, and use sudo to lower the authority if necessary

Cause of problem :

Yesterday, I installed a Debian under the /data/debian path through the Linux deploy software, and then I chrooted directly through the terminal emulator to use this Linux as root, but when I connected remotely, I found that the root user kept prompting me that the password was wrong. I have actually set up passwd under root authority, and then I adduser added a new user to provide remote access, when I connect remotely again, I found that I can log in and use this user, but then the problem comes, I need to escalate To install a certain dependency, but input sudo told me sudo 必须属于用户 ID 0(的用户)并且设置 setuid 位that the content I searched on the Internet was re-assigned as root to sudo 4755, u+s, root group, etc. The same low-quality articles, and later changed the keywords (chroot linux sudo ) to get the solution .

Stackoverflow forum original answer

Guess you like

Origin blog.csdn.net/sorry_my_life/article/details/112692354