Activate SMB via command line

roiegat
Contributor III

We have an image that is pretty locked up right now. But in working with our E-discovery group they've requested the ability to SMB into a machine to collect user files for investigations. Right now file sharing is not turned on and not set up.

I saw in the resource kit that there is a script to activate file sharing using AFP, but I need to do it using SMB. Ideally I would like to have one script to activate it for a machine and then another to deactivate it. This way we can keep it off until needed.

I've been trying to find good information on the smbd but can't seem to find a good example of how to start and stop it using command line. I would also need to set it up so it can access the whole machine via the admin account.

Any ideas? Suggestions?

3 REPLIES 3

jamie_ivanov
New Contributor

Leaving SMB access enabled won't consume much in terms of system resources, nor would it pose a security risk if setup properly. Otherwise you will need to use SSH using SSH keys for passwordless authentication for automatic daemon startup or have your E-discovery group SSH into a machine and start the daemon...

Another question is, does your group have local access account on each machine?

You will most likely need to setup and configure a Samba daemon on each machine. Configured properly, it can allow hidden and secured access to a remote machine.

NFS may be another option considering there is NFS support across Linux, Unix, Windows, and Mac OS X. It will be easier to setup and won't require installing anything additionally. The NFS daemon can be started and stopped via rc scripts or started and terminated manually via custom scripts. Windows Services for UNIX Version 3.5: http://www.microsoft.com/en-us/download/details.aspx?id=274

If you don't need much for security, a sample /etc/exports can be as simple as:

/Users -alldirs -ro

J.I.

roiegat
Contributor III

Thanks J.I.

I did have SSH set up for them, but they complained that when they copied the files over it messed with the metadata. Since the files could potentially be used in a legal matter the metadata need to be preserved.

Is there any script out there for setting up and configuring SMB?

jamie_ivanov
New Contributor

There are web based solutions that you can use to generate the smb.conf files for Samba such as Webmin or Swat (bundled with Samba). Once you've setup the config, it should be a task of making sure Samba is installed on each machine and launching smbd (and nmbd) directly or via init scripts. That's it.

J.I.