-
Notifications
You must be signed in to change notification settings - Fork 0
/
cs_keypair-rescue
47 lines (40 loc) · 1.1 KB
/
cs_keypair-rescue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Rescue instance using live CD from RC Admin
openstack image list | grep -i live
openstack server rescue --image [live-image-ID] [instance-ID]
# Booting to live CD, restart and login using console
# Mount root partition
fdisk -l
mount /dev/vdb1 /mnt
chroot /mnt
# Add temporary user, and grant sudo access
adduser [username]
passwd [username]
usermod -a -G whell/sudo [username]
# Modified ssh configuration
# Enable below lines
vi /etc/ssh/sshd_config
Port 22
ListenAddress 0.0.0.0
PermitRootLogin yes
PasswordAuthentication yes
AllowUsers [username]
# Check SELinux, disable if necessary
vi /etc/selinux/config
SELinux=disabled
setenforce 0
systemctl restart sshd
# SSH to instance
# Add new keypair to authorized_keys
openstack server unrescue [instance-ID]
-----------------------------------------------------
Rescue CentOS 6.
- using image ee701f25-d872-42a5-baf9-dc7fdfcf8f06
- sudo su
- mount disk and chroot
- disable selinux
- allow password login
- adduser with pw at once, give sudo access
useradd -p $(openssl passwd -1 password) username
usermod -a -G wheel username
visudo
- try to login and makesure