-
Notifications
You must be signed in to change notification settings - Fork 0
/
webdav_server
85 lines (60 loc) · 2.2 KB
/
webdav_server
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#Run these commands ON THE SERVER
#enable the epel repository as done for condor, you should see have this file:
cat /etc/yum.repos.d/epel.repo
####
#Install Apache:
yum install httpd
yum install cadaver
#Disable Apache's default welcome page:
sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
#Prevent the Apache web server from displaying files within the web directory:
sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf
#Start the service
systemctl start httpd.service
httpd -M | grep dav
#after running previous command, you should see as output something like
# dav_module (shared)
# dav_fs_module (shared)
# dav_lock_module (shared)
mkdir /var/www/html/webdav
chown -R apache:apache /var/www/html
chmod -R 755 /var/www/html
#you need to create a user account. Later on, you will use it to log into your WebDAV server.
htpasswd -c /etc/httpd/.htpasswd user001
chown root:apache /etc/httpd/.htpasswd
chmod 640 /etc/httpd/.htpasswd
#Create a virtual host for WebDAV
nano /etc/httpd/conf.d/webdav.conf
#Populate it with the following content
#####################################################
DavLockDB /var/www/html/DavLock
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/webdav/
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
Alias /webdav /var/www/html/webdav
<Directory /var/www/html/webdav>
DAV On
AuthType Basic
AuthName "webdav"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
</Directory>
</VirtualHost>
#####################################################
#disable selinux if enabled
setenforce 0
systemctl restart httpd.service
#############################################################
#############################################################
#Run the following commands ON THE CLIENT
yum install cadaver
cadaver http://<your-server-ip>/webdav/
#You will be asked the credentials you previously created
#To upload a local file to the WebDAV server:
dav:/webdav/> put /home/ec2-user/prova.txt
#To create a directory "dir1" on the WebDAV server:
dav:/webdav/> mkdir dir1
#To quit the cadaver shell:
dav:/webdav/> exit