Ubuntu18.04 start at boot sudo command ubuntu18.04 Android Studio error KVM is required to run this AVD / dev / kvm device:. Permission denied.

First, before the next text: start at ubuntu18.04 Android Studio error KVM is required to run this AVD / dev / kvm device:. Permission denied.

 After installing the Android Studio encountered a file operation to change the permissions problem (using sudo chown). Then put the command in your .bashrc file is time to start thinking about the self-assurance can file permissions (actually no, sudo chown change once).

But so I found a new problem. Due to write a sudo command in .bashrc file, every time you open a new terminal (cloud file .bashrc runs each time when the new terminal opens) will be asked to enter a password.

How to make ubuntu perform your sudo (root) command in the boot?

method one:

According to your original command in .bashrc file overwrite:

chown -R usrname sudo / dev / KVM   // original command 
echo password | usrname sudo chown -R -S / dev / KVM     // rewrite

   Note: This password is the password parameter -S specifically for execution when the sudo command to enter a password and prepared standard input.

Of course, this method is very bad, the password is written directly to the .bashrc file. And although no password, but each terminal will output the residual breaks (there may be ways to get rid of, too lazy ~ ~), it is not recommended.

Method Two:

Need to boot up and run sudo command can be written in /etc/rc.local, as /etc/rc.local to be executed as root.
The system startup will first call /etc/init.d/rc.local, then call in /etc/init.d/rc.local /etc/rc.local script. (Relationship between self baidu)
visible, first we must ensure /etc/rc.local enforceable rights to the root.

After u + x /etc/rc.local, sudo command can be added to achieve power is performed automatically by the sudo chmod to /etc/rc.local.

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/doggod/p/11925546.html