By cdevl3749
Bonjour,
à l’étape 9 j’ai un problème il ne créer pas mon fichier client1.ovpn
je reçois ceci :
~/client-configs$ sudo ./make_config.sh client1 ./make_config.sh: line 9: /root/client-configs/files/client1.ovpn: No such file or directory adminvpn@vps875:~/client-configs$
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello, @cdevl3749
Could you please link the exact tutorial that you’re following so I can have a look as well?
Also you can make sure that you’re executing the command from the correct directory, looking at the error message the file you’re trying to execute does not exist or at least is missing in the current directory.
You can double check you’re in the correct directory and also see if the file is existing in any other sub or main directory.
Did you created the script and client-configs directory as the root user? What is the output of
ls -lR /root/client-configs
That command will recursively list the contents of the directory.
You should have output that resembles the following:
sammy@ubuntu-2004-vpn:~/client-configs$ ls -lR
.:
total 16
-rwx------ 1 sammy sammy 1109 May 28 05:43 base.conf
drwx------ 2 sammy sammy 4096 May 28 05:35 files
drwx------ 2 sammy sammy 4096 May 28 05:42 keys
-rwx------ 1 sammy sammy 467 May 28 05:35 make_config.sh
./files:
total 8
-rwx------ 1 sammy sammy 5948 May 28 05:42 client1.ovpn
./keys:
total 16
-rw------- 1 sammy sammy 1204 May 28 05:41 ca.crt
-rw-rw-r-- 1 sammy sammy 2340 May 28 05:42 client1.crt
-rw------- 1 sammy sammy 1704 May 28 05:40 client1.key
-rw------- 1 sammy sammy 636 May 28 05:42 ta.key
If the script is owned by root you will need to change the ownership using chown
e.g - sudo chown -R user.user ~/client-configs
Let me know how it goes.
Regards, Alex
I found a solution, but I think someone else would be able to explain it better. So, the file is writing to /root/client-configs/files/client1.ovpn. /root/ doesn’t have the client-configs directory. I changed the script to go from:
#!/bin/bash
# First argument: Client identifier
KEY_DIR=~/client-configs/keys
OUTPUT_DIR=~/client-configs/files
BASE_CONFIG=~/client-configs/base.conf
cat ${BASE_CONFIG} \
<(echo -e '<ca>') \
${KEY_DIR}/ca.crt \
<(echo -e '</ca>\n<cert>') \
${KEY_DIR}/${1}.crt \
<(echo -e '</cert>\n<key>') \
${KEY_DIR}/${1}.key \
<(echo -e '</key>\n<tls-auth>') \
${KEY_DIR}/ta.key \
<(echo -e '</tls-auth>') \
> ${OUTPUT_DIR}/${1}.ovpn
to this:
#!/bin/bash
# First argument: Client identifier
KEY_DIR=/home/[myUser]/client-configs/keys
OUTPUT_DIR=/home/[myUser]/client-configs/files
BASE_CONFIG=/home/[myUser]/client-configs/base.conf
cat ${BASE_CONFIG} \
<(echo -e '<ca>') \
${KEY_DIR}/ca.crt \
<(echo -e '</ca>\n<cert>') \
${KEY_DIR}/${1}.crt \
<(echo -e '</cert>\n<key>') \
${KEY_DIR}/${1}.key \
<(echo -e '</key>\n<tls-auth>') \
${KEY_DIR}/ta.key \
<(echo -e '</tls-auth>') \
> ${OUTPUT_DIR}/${1}.ovpn
This worked for me, but I don’t think it’s the correct way to do it. Let me know how it went!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.