Access to Windows network shared folder from linux
-
Hi everyone,
I want to access to a Windows network shared folder, with domain and authentification, form my Qt application running on Ubuntu 19.10 to read and write files on it.
The connection parameters are set in the application, so I can't mount the folder in a terminal of linux.
I tried to execute the mount command with the QProcess class but I failed with a mount error 1: permission denied.
Do you have any idea to solve my problem ?
Thanks,
Francis
-
@Francis-Chapet said in Access to Windows network shared folder from linux:
I tried to execute the mount command with the QProcess class but I failed with a mount error 1: permission denied.
So are you able, running as yourself not root, to do the mount from the command line? If that is what you need to do for your issue (I don't know if it is, but...) then you'll either need to sort out the permissions or run the mount via
sudo
or similar....? -
I can execute successfully the mount command in a terminal with the sudo. there is the command i write in the terminal:
sudo mount.cifs //Server/Shared /home/user/mount/shared -o user=lgn,pass=pwd,dom=dmn
With the same command line in the QProcess::start parameter, I have the error mount 1 before having the sudo password request.
-
@Francis-Chapet said in Access to Windows network shared folder from linux:
With the same command line in the QProcess::start parameter, I have the error mount 1 before having the sudo password request.
First please show the actual code for command you issue via
QProcess
to make sure you are getting it right.If that is true then
sudo
must be detecting no stdin/terminal for prompting for the password for itself, and skipping doing so I guess.In any case, if you are going to need
sudo
and if you are going to need that to prompt the user for password from a GUI Qt app, you are going to have a problem. I haven't got time to find them in this forum, but there have been many questions about this. Then answer ends up being look at the-S
argument tosudo
and use that to get the password across to it. -
I found the solution to my problem. I have to execute my application with sudo. After that it can run the mount command without any error.
Thanks for your help.
-
@Francis-Chapet
That is one potential solution. However, if that is the only thing your app needssudo
for it is not a very good one. If you supplied your application to me I would not be prepared to run itsudo
. Up to you/your customers. -
Hi
Also be extremely careful if you delete files since you app now has the power
to wipe all of the root system if something goes wrong.