Hi list. I need to mount a samba share in ubuntu as non-sudo user. O found a tool (gvfs-mount) which could do the job. Based on it's source code I wrote a very basic code in C++, but I get some errors.
Here is the source code: #include <gtkmm.h> #include <iostream> Glib::RefPtr<Gio::File> file;Glib::RefPtr<Glib::MainLoop> main_loop; void on_async_ready(Glib::RefPtr<Gio::AsyncResult>& result){ file->mount_enclosing_volume_finish(result); main_loop->quit();} int main(){ Gio::init(); Glib::init(); main_loop = Glib::MainLoop::create(false); file = Gio::File::create_for_commandline_arg("smb://192.168.1.3/Memory\\ core"); Glib::RefPtr<Gio::MountOperation> mount_operation = Gio::MountOperation::create(); mount_operation->set_domain("domain"); mount_operation->set_username("user"); mount_operation->set_password("password"); try { file->mount_enclosing_volume(mount_operation, &on_async_ready); } catch(const Glib::Error& ex) { std::cerr << ex.what() << std::endl; } main_loop->run(); return 0;} The problem is that when I run this code as normal user I get this output: (process:5816): glibmm-CRITICAL **: unhandled exception (type Glib::Error) in signal handler: domain: g-io-error-quark code : 0 what : Failed to mount Windows share: Operation not permitted When I run as sudo I get this: (process:5862): glibmm-CRITICAL **: unhandled exception (type Glib::Error) in signal handler: domain: g-io-error-quark code : 15 what : volume doesn't implement mount If I run the gvfs-mount with the same uri which is in source, after I enter the domain, username and password, the shared folder gets mounted. Any help would be appreciated.
_______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list