Skip to content

Commit f2f85c7

Browse files
author
enoch85
committed
add new WP user
1 parent 3d78831 commit f2f85c7

File tree

4 files changed

+72
-7
lines changed

4 files changed

+72
-7
lines changed

index.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<style>
55
body {
66
background-image: url("https://www.techandme.se/wp-content/uploads/2015/12/bbbackground-1200-1024x683.jpg");
7+
background-size: cover;
78
font-weight: 300;
89
font-size: 1em;
910
line-height: 1.6em;
@@ -23,7 +24,7 @@
2324
background-image: url('https://www.techandme.se/wp-content/uploads/2015/01/WordPress-Logo-540x348.png');
2425
background-repeat: no-repeat; top center;
2526
width: 50%;
26-
height: 25%;
27+
height: 30%;
2728
margin: 0 auto;
2829
background-size: 40%;
2930
margin-left: 40%;
@@ -70,7 +71,7 @@
7071
<div class="logo">
7172
</div>
7273
<div class="logotext">
73-
<h2>ownCloud VM - <a href="https://www.techandme.se/pre-configured-wordpress-installaton/" target="_blank">Tech and Me</a></h2>
74+
<h2>Wordpress VM - <a href="https://www.techandme.se/pre-configured-wordpress-installaton/" target="_blank">Tech and Me</a></h2>
7475
</div>
7576
<br>
7677
<div class="information">
@@ -88,7 +89,7 @@
8889
<h3>wordpress</h3>
8990
<p>Default Password:</p>
9091
<h3>wordpress</h3>
91-
<p>Note: The setup script will ask you to change the default password to your own. It's also recomended to change the default user. Do this by adding another admin user. Don't forget to delete the old user "change_wordpress_user#" after you created you new admin account.</p>
92+
<p>Note: The setup script will ask you to change the default password to your own.</p>
9293
<br>
9394
<center>
9495
<h3> How to mount the VM and and login:</h3>
@@ -106,8 +107,8 @@
106107
<p>Use one of the following addresses, HTTPS is preffered:
107108
<h3>
108109
<ul>
109-
<li><a href="http://<?=$_SERVER['SERVER_NAME'];?>/wordpress" >http://<?=$_SERVER['SERVER_NAME'];?></a> (HTTP)
110-
<li><a href="https://<?=$_SERVER['SERVER_NAME'];?>/wordpress" >https://<?=$_SERVER['SERVER_NAME'];?></a> (HTTPS)
110+
<li><a href="http://<?=$_SERVER['SERVER_NAME'];?>/wordpress/wp-login.php" >http://<?=$_SERVER['SERVER_NAME'];?></a> (HTTP)
111+
<li><a href="https://<?=$_SERVER['SERVER_NAME'];?>/wordpress/wp-login.php" >https://<?=$_SERVER['SERVER_NAME'];?></a> (HTTPS)
111112
<p>
112113
</ul>
113114
</h3>
@@ -148,7 +149,7 @@
148149
</h3>
149150
<p>Note: Please accept the warning in the browser if you connect via HTTPS.</p>
150151
<h3>
151-
<a href="https://www.techandme.se/user-and-password/" target="_blank">Login details</a>
152+
<a href="https://www.techandme.se/user-pass/" target="_blank">Login details</a>
152153
</h3>
153154
<p>Note: Your external IP is set as approved in /etc/apache2/conf-available/phpmyadmin.conf, all other access is forbidden.<p/>
154155
</div>

techandme.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
WANIP=$(dig +short myip.opendns.com @resolver1.opendns.com)
33
ADDRESS=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
4+
WPADMINUSER=$(grep "WP USER:" /var/adminpass.txt)
45
WPADMINPASS=$(grep "WP PASS:" /var/adminpass.txt)
56
clear
67
figlet -f small Tech and Me
@@ -12,7 +13,7 @@ echo "WAN IP: $WANIP"
1213
echo "LAN IP: $ADDRESS"
1314
echo
1415
echo "--|WORDPRESS LOGIN|--"
15-
echo "WP USER: change_wordpress_user#"
16+
echo "$WPADMINUSER"
1617
echo "$WPADMINPASS"
1718
echo
1819
echo "--|MySQL|--"

wordpress-startup-script.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,67 @@ else
224224
fi
225225
clear
226226

227+
# Create new WP user
228+
cat << ENTERNEW
229+
+-----------------------------------------------+
230+
| Please create a new user for Wordpress: |
231+
+-----------------------------------------------+
232+
ENTERNEW
233+
234+
echo
235+
echo "Enter username:"
236+
read USER
237+
echo
238+
echo "Enter password:"
239+
read NEWWPADMINPASS
240+
echo
241+
echo "Enter email address:"
242+
read EMAIL
243+
244+
function ask_yes_or_no() {
245+
read -p "$1 ([y]es or [N]o): "
246+
case $(echo $REPLY | tr '[A-Z]' '[a-z]') in
247+
y|yes) echo "yes" ;;
248+
*) echo "no" ;;
249+
esac
250+
}
251+
echo
252+
if [[ "no" == $(ask_yes_or_no "Is this correct? User: $USER Password: $NEWWPADMINPASS Email: $EMAIL") ]]
253+
then
254+
echo
255+
echo
256+
cat << ENTERNEW2
257+
+-----------------------------------------------+
258+
| OK, try again. (2/2) |
259+
| Please create a new user for Wordpress: |
260+
| It's important that it's correct, because |
261+
| the script is based on what you enter |
262+
+-----------------------------------------------+
263+
ENTERNEW2
264+
echo
265+
echo "Enter username:"
266+
read USER
267+
echo
268+
echo "Enter password:"
269+
read NEWWPADMINPASS
270+
echo
271+
echo "Enter email address:"
272+
read EMAIL
273+
fi
274+
wp user create $USER $EMAIL --role=administrator --user_pass=$NEWWPADMINPASS --path=$WPATH --allow-root
275+
wp user delete 1 --allow-root --reassign=$USER --path=$WPATH
276+
echo "WP USER: $USER" > /var/adminpass.txt
277+
echo "WP PASS: $NEWWPADMINPASS" >> /var/adminpass.txt
278+
279+
# Show current administrators
280+
echo
281+
echo "This is the current administrator(s):"
282+
wp user list --role=administrator --path=$WPATH --allow-root
283+
echo -e "\e[32m"
284+
read -p "Press any key to continue... " -n1 -s
285+
echo -e "\e[0m"
286+
clear
287+
227288
# Let's Encrypt
228289
function ask_yes_or_no() {
229290
read -p "$1 ([y]es or [N]o): "

wordpress_update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ sudo apt-get update
1515
sudo aptitude full-upgrade -y
1616
cd $WPATH
1717
wp db export mysql_backup.sql --allow-root
18+
mv $WPATH/mysql_backup.sql /var/www/html/mysql_backup.sql
19+
chown root:root /var/www/html/mysql_backup.sql
1820
wp core update --force --allow-root
1921
wp plugin update --all --allow-root
2022
wp core update-db --allow-root

0 commit comments

Comments
 (0)