Search code examples
ruby-on-railswindowssambarhel

samba share on rails


I am writing an XML file in rails(running on RHEL) and will then need to post this file across to a windows share.

Sambala was installed so that we can SMB to the share, but after running some test code I get the error: uninitialized constant ApplicationController::Sambala

samba = Sambala.new(  :domain   =>  'myDOMAIN',
                      :host     =>  'myHOST',
                      :share    =>  'mySHARE',
                      :user     =>  'myUSER',
                      :password =>  'myPASSWORD')

    samba.cd('mySHARE')   # =>  true
    samba.put(:from => 'aLocalFile.txt')

Is there a better way to connect to a windows share using rails on RHEL? or do I need to include a reference to sambala somewhere?


Solution

  • using the ` key you can send OS commands.

    `mount -t cifs //server/share -o username=USERNAME,password=PASSWORD /directoryToMount`