Login como root no servidor ubuntu 14.04

0

Eu tenho um problema para fazer o login como root.
Meu arquivo '/etc/passwd' é como

root:x:0:0:root:/root:which zsh
....
....

Eu fiz uma pergunta semelhante em "Como posso alterar o shell para o original (/ bin / bash) sem raiz privilégio? " e eu as sugestões propostas, mas até agora não funciona.

[]@[]:~$ su - root
Password:
Cannot execute which zsh: No such file or directory
[]@[]:~$ su - -s /bin/bash
Password:
Cannot execute which zsh: No such file or directory
[]@[]:~$ su - -s /bin/bash root
Password:
Cannot execute which zsh: No such file or directory
[]@[]:~$ su -s /bin/bash root
Password:
Cannot execute which zsh: No such file or directory

Alguma sugestão para esta situação?

    
por Jason Huh 20.09.2015 / 16:09

2 respostas

0

Use o seguinte comando, substituindo /bin/sh pelo seu shell preferido:

SHELL=/bin/sh sudo -s

Este comando define primeiro a variável de ambiente SHELL temporariamente para /bin/sh ou o shell que você escolheu. Em seguida, ele invoca sudo -s , que faz o login no shell definido pela variável SHELL .

Veja o log de terminal de exemplo. Observe a ps output que exibe bash (meu shell padrão) e uma vez sh como segundo processo na hierarquia, bem como os diferentes prompts.

$  sudo -s
root: ~ #  ps
  PID TTY          TIME CMD
23103 pts/2    00:00:00 sudo
23104 pts/2    00:00:00 bash
23146 pts/2    00:00:00 ps
root: ~ #  exit
ipc-admin: ~ $  SHELL=/bin/sh sudo -s
# ps
  PID TTY          TIME CMD
23190 pts/2    00:00:00 sudo
23191 pts/2    00:00:00 sh
23200 pts/2    00:00:00 ps
# exit
$
    
por 21.09.2015 / 15:11
0

Tente alterar o runlevel no momento da inicialização e comece com runlevel 1 .
Então você será root e poderá editar cada arquivo.

If using LILO, access the boot: prompt by typing [Ctrl]-[X]. Then type:

linux 1

If using GRUB, follow these steps:

  • In the graphical GRUB boot loader screen, select a label and press [e] to edit it.
  • Arrow down to the kernel line and press [e] to edit it.
  • At the prompt, type the number of the runlevel you wish to boot into (1 through 5), or the words single or emergency and press [Enter]. In your case 1
  • The GRUB screen reappears with the kernel information. Press the [b] key to boot the system.

Quando você está no modo de usuário único , você é o root. Use vi (ou nano ou pico ...) e corrija seu arquivo /etc/passwd .

Referência:

por 22.09.2015 / 18:27