Hello.
I try to add a password on my VirtualHere Server 4.5.0
I have a licence. I followed this page : https://www.virtualhere.com/authorization
Windows client V5.4.2 NOT running as a Service.
So I stop virtualhere service and in the /root/config.ini I added this line :
clientAuthorization=/home/root/auth.sh "$VENDOR_ID$" "$PRODUCT_ID$" "$CLIENT_ID$" "$CLIENT_IP$" "$PRODUCT_SERIAL$" "$PASSWORD$" "$DEVPATH$" "$NICKNAME$" "$NUM_BINDINGS$"
Then in /home/root/ I created the file auth.sh and I added thoses line inside :
#!/bin/bash
# Example script for performing basic user authorization for virtualhere
# Also includes a simple password protection mechanism for accessing a device
# Return 3 if the user needs to provide a username AND password (or the password is incorrect) to use the device
# Return 2 if the user needs to provide ONLY a password (or the password is incorrect) to use the device. The username defaults to the client OS username
# Return 1 if the user is allowed to access this device
# Return 0 if the user is not allowed to access this device
# Parameters are passed in as:
# $1 = VENDOR_ID
# $2 = PRODUCT_ID
# $3 = CLIENT_ID
# $4 = CLIENT_IP
# $5 = PRODUCT_SERIAL
# $6 = PASSWORD
# $7 = DEVPATH
# $8 = NICKNAME
# $9 = NUM_BINDINGS
logger "Authorizing -> '$1' '$2' '$3' '$4' '$5' '$6' '$7' '$8' '$9'"
# "test" = "098f6bcd4621d373cade4e832627b4f6" as an MD5 hash https://www.md5hashgenerator.com/
if [ "$6" = "098f6bcd4621d373cade4e832627b4f6" ]; then
echo "Password ok"
else
exit 2
fi
exit 1
I reboot the server and when i try to connect to any USB I got this error : "there was an error using this device"
Any Idea?
Thanks
.
Check in the /var/log/syslog on the server for the error reason, it will say the reason why its being rejected. You might not have
chmod +x
that scriptvar/log/syslog
Hello.
In the /var/log/ I don't have any syslog file.
Yes I run this command line :
chmod +x /home/root/auth.sh
I still have the problem.
Thanks for your help.
.
OK check syslog and it will say the reason. I dont know your linux distribution so you need to figure out where syslog is on your machine.
FriendlyELEC Syslog?
Thanks.
Im looking for the syslog but i cant find it for the moment.
The distrib is FriendlyELEC for NanoPi based on Ubuntu 16.04.7 LTS.
Im looking for the syslog file.
Thanks.
syslog
Ok done.
Rsyslog was missing in Ubuntu.
I setup Rsyslog and here are the message :
Feb 21 11:30:24 NanoPi-NEO2 vhusbdarm[567]: Unknown return value 127 from clientAuthorization
Feb 21 11:30:24 NanoPi-NEO2 vhusbdarm[567]: Error binding device 5111 [064f:2af9] to connection 1, BIND_ERROR
Any Idea?
Thanks.
.
OK it is returning an error in the bash script. It is probably not well formed or something.
Just run the bash script directly outside of virtualhere and see if there is an error e.g
run this on the terminal prompt:
/home/root/auth.sh
Text file busy
Ok.
So I modified the file path to /home/pi/auth.sh
root was making a problem.
Now here is the error :
root@NanoPi-NEO2:/home/pi# /home/pi/auth.sh
-bash: /home/pi/auth.sh: /bin/bash^M: bad interpreter: Text file busy
I try again and I have another message.
root@NanoPi-NEO2:/home/pi# ls
auth.sh config.ini vhusbdarm.1 vhusbdarm.2 vhusbdarm.3 vhusbdx86_64
root@NanoPi-NEO2:/home/pi# cd
root@NanoPi-NEO2:~# /home/pi/auth.sh
-bash: /home/pi/auth.sh: /bin/bash^M: bad interpreter: No such file or directory
Bit strange he cant find the File...
Thanks.
.
If you see a ^M at the end then it means you have used windows to edit the file with a CRLF instead of just a CR. This is getting into linux territory and this is not a website to learn linux, there are plenty out there e.g here and how to fix