Last change
on this file since 153 was 153, checked in by Bruno Cornec, 17 years ago |
Adds pbsetupqemu as an example of script to setup the QEMU VM
|
-
Property svn:executable
set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # Script to be used as pbscript to create a potentialy
|
---|
4 | # missing pb account on the QEMU VM, and adds it to sudo
|
---|
5 | #
|
---|
6 | # Needs to use rrot account to connect to the VM
|
---|
7 |
|
---|
8 | # You need to specify here your local public SSH key used to access
|
---|
9 | # the pb account in the VM later on
|
---|
10 |
|
---|
11 | cat > /tmp/pbkey << EOF
|
---|
12 | ssh-dss AAAAB3NzaC1kc3MAAACBAMC06bNLMu8ZBJv3Hi77+fi+GUhtQScIbGKru86C/IP27EjrmYhPVccbu8kpX6SDHIouhpZ00gaefP3zHjLUmPKlXkMNUNjxx5JNLPoHhSIuUvoSTNoh9gsi31abAvzbW+RNer7rvBJO4ytNJRdsuNxBwqjxK04JEmatds+aKTQjAAAAFQDHaNmIuvYZ0RtNBVe+tzTzxxCQmQAAAIA4o89Xob2VBRtQKBjmWVAuTS14qiqnQUPNloaRkM+r2odI+NJDFc+WXOIG9QAPKKt1jvFOBOX9Mu3/xwiDLnAGhxud98FoyHevSpIWUld7rG4j1aww1WxolFWY/iPyAvDDMW3iysCoqQeSOlpRd9Mz/dq6/P/VcizhdGOKyc3JBgAAAIAA1eY+BoneiQ/tQ8j3GYbMTu6U7VzZ2OaoVeQn4NtZmPl+ZeQIj83nFpo99mYCbaBPqnZToERndl+ljp/JX5pamwj6RcLIDCyiB6MXLbQSWj0goegU1htp5aMd3NcyR2Jy8gCnf0QjDr7j23Q+CFGExtRb/nsDmaG5W9D6QSWQ/g== bruno@victoria
|
---|
13 | EOF
|
---|
14 | chmod 644 /tmp/pbkey
|
---|
15 |
|
---|
16 | grep -Eq '^pb:' /etc/passwd
|
---|
17 | if [ $? -ne 0 ]; then
|
---|
18 | su - -c "useradd pb"
|
---|
19 | fi
|
---|
20 |
|
---|
21 | # No passwd for pb only keys
|
---|
22 | perl -pi -e 's/^pb:\!\!:/pb:*:/' /etc/shadow
|
---|
23 | # Adapt sudoers
|
---|
24 | grep -Eq '^pb ' /etc/sudoers
|
---|
25 | if [ $? -ne 0 ]; then
|
---|
26 | echo "pb ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
---|
27 | fi
|
---|
28 | # poweroff only
|
---|
29 |
|
---|
30 | su - pb -c "mkdir -p .ssh ; chmod 700 .ssh ; cp /tmp/pbkey .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys"
|
---|
31 | rm -f /tmp/pbkey
|
---|
Note:
See
TracBrowser
for help on using the repository browser.