Puppet: Add mount point as a windows shared drive - puppet

How to add a windows share drive on the fileserver.conf? and use this as a mounting point for files.
Guessing if this can't be done. Do I need to install samba services and then mount the windows share drive using the mount command?
ideas?

You need samba but puppet can ensure samba and all dependencies are installed. so all you need
is proper puppet manifests.
you can look at an example puppet samba module here.
https://github.com/AllPlayers/puppet-samba
Look at smb.conf.erb, thats where you would define all the samba mount points.

Related

Blank SSHFS mount folder

I am attempting to mount a remote directory located on my web server to a directory in my xUbuntu installedation hosted in a VirtualBox.
I'm using the following command syntax:
sshfs root#*.*.*.*:/var/www Desktop/RemoteMount
Using the file manager, I navigate to the Desktop/RemoteMount directory but find it entirely blank. The SSHFS command above executed with no indication of an error.
Completely by chance, I use the terminal to long list the contents of the Desktop/RemoteMount directory and it shows all the data I was expecting to see in the file manager.
Can anyone tell me why the file manager does not show my remotely mounted data and how I might fix it?
Thanks.
you are missing local mountpoint.
sshfs -o idmap=user mika#192.168.1.2:/home/mika/remotepoint /home/mika/localmountpoint.
And You need to have localmount folder exist.
thanks Mika

mount remote windows share from centos

I am trying to setup a script that will:
Connect to a windows share
Using LOAD DATA LOCAL INFILE, upload the two files into their appropriate db tables
Umount share
Situation:
I can currently vpnc into this remote machine
Problem:
I cannot
mount -t cifs //ip.address/share /mnt/point -o username=u,password=p,port=445
mount error(110) Connection timed out
I am attempting to do this manually first
Remote server is open to port 445
Questions:
Do I even need to vpnc in first?
Do I need to do route add for the remote ip/mask/gw after vpnc?
Thank you!
The mount.cifs file is provided by the samba-client package. This can be installed from the standard CentOS yum repository by running the following command:
yum install samba samba-client cifs-utils
Once installed, you can mount a Windows SMB share on your CentOS server by running the following command:
Syntax:
mount.cifs //SERVER_ADDRESS/SHARE_NAME MOUNT_POINT -o user=USERNAME
SERVER_ADDRESS: Windows system’s IP address or hostname
SHARE_NAME: The name of the shared folder configured on the Windows system
USERNAME: Windows user that has access to this share
MOUNT_POINT: The local mount point on your CentOS server
I am mounting to a share from \\10.11.10.26\snaps
Make a directory under mount for your reference
mkdir /mnt/mymount
Now I am mounting the snaps folder from indiafps02, User name is the Domain credentials, i.e. Mydomain in this case
mount.cifs //10.11.10.26/snaps /mnt/mymount -o user=Girish.KG
Now you could see the content by typing
ls /mnt/mymount
So, after performing your task, just fire umount command
umount /mnt/mymount
That's it. You are done.
no need to install "samba" and "samba-client", only "cifs-utils" using command
yum install cifs-utils
after that in windows share the folder you would like to mount in centos if you didn't do that already ("c:\interpub\wwwroot" in my case).
make sure you share it with a specific username whom your know the password for ("netops" in my case).
create a directory in centos in which you would like to mount the windows share in to ("/mnt/cm" in my case).
after that run that simple command as a root
mount.cifs //10.16.0.160/wwwroot /mnt/cm/ -o user=netops
centos will prompt you for the windows username password.
you are done.

Install chromium to Linux disk image?

I'm sure this has been asked before but I have no clue what to search for
I am trying to create a custom Linux image (for the Raspberry Pi) - I am currently manipulating the filesystem of the .img but I've discovered it's not as simple as dropping in the binary :( if only...
What is the accepted way to "pre-install" a package on a disk image where you can only manipulate the filesystem and ideally not run it first? Am I best to boot up, install, and then create the image from that, or is there a way of doing it beforehand in the same way you can change configuration settings etc?
Usually, when I have to change something in a disk image, I do the following:
sudo mount --bind /proc /mnt/disk_image/proc
sudo mount --bind /sys /mnt/disk_image/sys
sudo mount --bind /dev /mnt/disk_image/dev
These action are needed as this folder are create during boot process, mounting them in your system image will emulate a full boot. Then, you can chroot on it safely:
sudo chroot /mnt/disk_image
You're now able to issue commands in the chroot environment:
sudo apt-get install chromium
Of course, change /mnt/disk_image to the path where you have mounted your filesystem. apt-get will only works on Debian based system, change it according to your distribution.
You could find problem connecting to the internet and it can be cause by DNS configuration. The best thing you can do, is to copy your /etc/resolv.conf file in the remote filesystem as this file is usually changed by dhcp and it's empty on chroot environment.
This is the only solution that gives you full access to the command line of the system you're trying to modify.
This is an untested idea:
The dpkg tool, which can install .deb packages, has a --root option which can set a different filesystem than the local / path.
From the man page:
--instdir=dir
Change default installation directory which refers to the
directory where packages are to be installed. instdir is
also the directory passed to chroot(2) before running
package’s installation scripts, which means that the
scripts see instdir as a root directory. (Defaults to /)
--root=dir
Changing root changes instdir to dir and admindir to
dir/var/lib/dpkg.
If you mount your image and pass its mountpoint as --root, it should work.
There are things like the Ubuntu Customization Kit which allow you to create your own version of the distro with your own packages.
Crunchbang even has a utility like this, which is the distro I have personally selected for experimenting with my Pi.

Nodejs + npm, installing modules on ntfs partition

I have a problem when installing npm modules. NodeJS is installed on Ubuntu 11.10 running on Virtual Box on Windows host. My project files are on NTFS partition (I have to share them with windows). When I try to install some npm module I get an error, and module is not installed. I've found out that problem occurs when npm tries to create symbolic links.
Probably you can not create symlinks on NTFS partition, when I'm installing module "inside" Linux file system, everything works fine.
How can I fix this? I don't want to resolve dependencies manually :/
Since version 1.2.21, npm has a new option for the install command. --no-bin-links
You can use if for installing a specific node module
npm install express --no-bin-links
and also for a package.json install
npm install --no-bin-links
With this option I've been able to install many npm modules without problems in my shared forlder inside the VM (Ubuntu guest, Windows Host)
The commit where the option was added to the npm code is b4c58617039c21c10889a9869f8e86a23e17d3a0
Try this - http://ahtik.com/blog/2012/08/16/fixing-your-virtualbox-shared-folder-symlink-error/
Works for me!
Basically you set a parameter
VBoxManage setextradata YOURVMNAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/YOURSHAREFOLDERNAME 1
And then run the VM as an administrator....
The Symlink permissions, or the --no-bin-links didn't work for us. Instead we opted to move our node_modules away from the /vagrant share. We created a symlink from /vagrant/node_modules to /tmp/node_modules. You can only do this if your node_modules is not in version control. Check this first!
Also see http://kmile.nl/post/73956428426/npm-vagrant-and-symlinks-on-windows
I am pretty certain symlinks can't be created on the shared drive ("shared folder"). Even more impossible with a Windows host machine and a Linux guest.
The host machines are not aware of the filesystem of the guests. A guest machine is a blackbox for the host. You can't say to the host "Well this links to /etc/..." when the host doesn't know where this /etc is :).
So in short: unfortunately no.
In some more detail:
I would be really happy if I am wrong! It is a major pain in my development process.
I tried so many options. By default the filesystem that the "shared folders" use is vboxsf, something if not the same as samba (default network sharing protocol for windows) so:
I tried using native Windows network sharing and then mounting the network drive in the guest as the guest and host are on the same network. The problem was still there.
I tried running a NFS server on windows (Hanewin NFS Server) along with SFU/SUA (Windows Services for UNIX) but this has problems with GIT locks. Probably other problems as well - it was a while ago and I don't clearly remember
I tried the reverse: sharing a directory on the virtual machine to windows. But that is stupid as all the files will be on the virtual box and is reaally slow to access on windows
I was being stupid and I though "well let's mount a virtual drive on both windows and linux" - don't try this, corrupts the virtual disk. Something I should have known.
There might be a network sharing protocol other than samba and nfs which will perhaps copy the files whenever "symlink" creation is attempted? I don't know really.
However I haven't found one yet and also "locking" seems to to be a task of the file-system itself so I doubt any network protocol (unless having a dedicated registry of some sort for locks) can do this.
For anyone still having this problem after trying npm install --no-bin-links.
I wasn't able to get any of the above solutions to work when I came across a similar issue running npm install on a Laravel Homestead Vagrant box on a Windows 7 host using VirtualBox. The guest box has a mapped directory to the Windows file system.
The problem was causing various error messages and failed package installations. The one that is most relevant to the question was npm ERR! UNKNOWN, symlink '<some filename>'.
To fix this, I was able to successfully run npm install on the Git bash command line on Windows rather than bash on the guest Linux.
To do this, you will need to install Git for Windows and NodeJS (both on your Windows box).
e.g.
Install Chocolatey https://chocolatey.org/
choco install nodejs.install
choco install git.install
Run C:\Program Files (x86)\Git\Git Bash.vbs
In the Git Bash command line, change directory to the location of your package.json file e.g. cd /c/projects/projectname
Run npm install
Everything appears to install successfully.
If you don't use native modules (compiled from C/C++) you can just use npm on your Ubuntu VM and copy the node_modules folder to you windows drive.
fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1
this command enables symlinks on windows. for a better explanation to the cryptic commands at the end visit: How do I overcome the "The symbolic link cannot be followed because its type is disabled." error when getting the target of a symbolic link on Server 2008?
in summary
The behavior codes for fsutil behavior set SymlinkEvaluation - namely L2L, L2R, R2L, and R2R - mean the following:
L stands for "Local", and R for "Remote" (who would've thunk?)
The FIRST L or R - before the 2 - refers to the location of the link itself (as opposed to its target) relative to the machine ACCESSING the link.
The SECOND L or R - after the 2 - refers to the location of the link's target relative to the machine where the LINK itself is located.

MPD permission denied when using sshfs - how to change permissions?

I am trying to mount my music folder from another computer on my network using sshfs. The folder mounts correctly and I can access the files using the terminal. However, when I try to update my MPD library using ncmpcpp I get a permission denied error in mpd.log. When the filesystem is not mounted to the music folder is can be accessed by mpd. What can I do to the folder so that mpd can see it?
Thanks
MPD is probably not running under the same user account that you used to mount the sshfs filesystem.
See the FUSE FAQ and the sshfs FAQ, then if you're comfortable with the security risks add the user_allow_other option to /etc/fuse.conf and the -o allow_other option to the mount command.

Resources