Sponsored Content
Full Discussion: Copy to Windows hidden share
Operating Systems AIX Copy to Windows hidden share Post 302999536 by pob579 on Thursday 22nd of June 2017 10:04:32 AM
Old 06-22-2017
Hello,
first thanks to all for trying to help...

to Don Cragun:

here is a link to Linux instructions:
geekyboy.com/archives/200
NOTE!:
My TrendMicro agent produce an Alert about blocking a further link from this site as malicious...
Most probably false positive... but just in case if you don't want to touch the link I copy- paste the text from the blog.

I don't manage the server (it is vendor's ). I will greatly appreciate if somebody can really test a copy to hidden share on Windows (2012) and provide the exact workaround/instruction...

Here is a quick suggestion from an another forum:
*********************************************************
I don't think the password is the problem. I think the admin just needs to escape the "$" in the hidden share with a backslash. e.g.
Code:
mount -t cifs //server/hiddenshare\$ -o username=adminUserName,password=myPassword /mnt/srvshare

*******************************************

and here is a text from the blog (from site with an alert)

Backup files from Linux to a Windows server
Ok, this may be my last disaster recovery and backup blog for a long time. As you can probably tell from the title this blog entry is all about keeping backup strategies as cheap as possible.
My strategy is to backup all of my Windows and Linux servers to one central Windows server that is running a Tivoli backup agent. All of my servers are hosted elsewhere, and since it costs $99.00 per server to backup I am getting the most for my money by only backing a single server to tape/SAN. However that single server carries all of the files that need to be remotely backed up to tape/SAN.
My earlier posts show how to backup the Windows servers:
Windows backup bat script using xcopy
Also, how to backup the Windows Domain Controller:
Backup Windows Domain Controller using NTBACKUP via cmd
And I also showed how to backup a Linux server to a local file:
Linux backup using CRON to local directory
Now I will show how I moved the files backed up on the Linux servers to the Windows server prior to tape/SAN backup. I have decided to use Samba and mount a directory pointing to a shared folder on the Windows server. Lets begin:
Create a share on the Windows server to use as your backup location.
Create a user to use this share, and give the user permissions to use it.
Pick, or create, a user that you’re going to use to backup the files. Log in as this user and type ‘id’ to get the numeric ID of the user in the Linux OS. (You will need it later.)
Become ‘root’. (This will enable you to perform the next tasks without problems.)
Install samba and samba-client if they are not installed yet.
Code:
yum install samba
yum install samba-client

You will need to answer ‘y’ to when prompted.
By default only the root user can mount or unmount a cifs, so we must open it to other users.
Code:
chmod 4755 /sbin/mount.cifs
chmod 4755 /sbin/umount.cifs

Now we need to make a directory to use as our mount point.
Code:
mkdir /mnt/sharename

To enable our desired user to mount and unmount this we need to assign ownership to that user. Changing permissions with chmod is not enough.
Code:
chown userfrom#1 /mnt/sharename

Now we need to edit the /etc/fstab file and add an entry. Replace the user ID of 500 with your user ID from #1. Replace sharename with your Windows share name. Replace WINDOWSHOST with your hostname or IP address. If you don’t know the shares run
Code:
smbclient -L WINDOWSHOST //WINDOWSHOST/sharename /mnt/sharename cifs credentials=/root/smblogin,uid=500,noauto,user 0 0

Create/Edit a file /root/smblogin and put the following two lines in it.
Code:
username=WINDOWS USERNAME
password=WINDOWS PASSWORD

Now we must give our user from #1 access to the file, but still protect it.
Code:
chown userfrom#1 /root/smblogin
chmod 600 /root/smblogin

If you have IPTABLES active on your server you will need to make sure to add a policy to allow OUTPUT port 445.
Log in as the user from #1
Try to mount the share:
Code:
mount /mnt/sharename
ls -la /mnt/sharename
umount /mnt/sharename

If that was successful you are now ready to write a script that will automate the moving of your backup files from the Linux to the Windows share. (Script/File = backup.sh)
Code:
#!/bin/sh
mount /mnt/sharename
*
cp -r /path/to/file.tar.gz /mnt/sharename/path/to/file.tar.gz
*
umount /mnt/sharename

Of course you can add this to the end of the file described in Linux backup using CRON to local directory which would create a complete solution for backing up files, then relocating them to a remote Windows server.
Next you will add an entry to the crontab of the user from #1 to happen automagically.
Code:
crontab -e -u userfrom#1

Enter this into the crontab.
Code:
# Backup at 1:00 A.M. every day. Call 'man 5 crontab' for more information
* 1 * * * /path/to/backup.sh

Now once this is all done you can rest a little bit easier knowing that your servers are backed up. Published by

Last edited by rbatte1; 06-22-2017 at 12:48 PM.. Reason: Added CODE tags to make it more readable
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

recursive copy of hidden files

I need to know how to copy hidden files recursively? cp -r sourceDir/* targetDir/. ignores the hidden files. Thank you!! (2 Replies)
Discussion started by: usfrog
2 Replies

2. UNIX for Dummies Questions & Answers

how to copy hidden files from one folder to another

dear all, i want to copy all files in my home dir to another. from my home dir i have given ls -la then some hidden files are there with dot . .. and i also want to copy all dirs in my home as it is . because iam upgrading the system how to copy all files and dirs in my home dir... (1 Reply)
Discussion started by: rajan_ka1
1 Replies

3. IP Networking

how to share with windows

i m using Linux Mint on my computer and i m the server of shared Internet connection with windows machines. Internet sharing is working well with all the machines but file sharing is not working well. I can access the shared folders of other system with windows machine the windows machines cannot... (1 Reply)
Discussion started by: giri.nitp
1 Replies

4. AIX

Need help with Windows Share please

I have a windows 2003 server with services for unix installed I have create a folder c:\nfsshare and set it as an nfs share named nfsshare. now I am trying to mount it from my aix system using mount <server ip>:/nfsshare /mnt the filesystem mounts , but I cannot change into /mnt, I get a... (4 Replies)
Discussion started by: bbbngowc
4 Replies

5. UNIX for Advanced & Expert Users

windows printers share

Hello, My network environment is: The server is Linux, all the clients are win2000 professional, the PC names are(ws00201, ws00202,ws00203,ws00204,ws00205,ws00206,ws00207,ws00208,ws00209), I have 3 printers connected through USB to ws00201, ws00204,ws00207, I want ws00201,ws00202,ws00203... (1 Reply)
Discussion started by: truelyli
1 Replies

6. Shell Programming and Scripting

Script to copy User home folders to mounted windows share

First of all, let me state that I am a windows admin. I have a windows share mounted to /mnt/server I need a script that will either login as sudo or perform commands with sudo rights. I need the script to copy all of the users /home folders to the mounted windows share. Now If I can... (7 Replies)
Discussion started by: EricM
7 Replies

7. UNIX for Dummies Questions & Answers

Windows Share

Hi guys I have some Windows Shares and I need to mount those shares on my Suse 10 SP3 I would like to know how to mount those? do I need to enable Samba? or is it just a simple mount command? thanks a lot (2 Replies)
Discussion started by: karlochacon
2 Replies

8. UNIX for Beginners Questions & Answers

Copy files to samba share Ubuntu 14.04

I am trying to use mv or cp rsync to copy folders to a samba share. I can manually copy the folders to the share, but can not seem to access it using command line. Thank you :). smbclient //path/to/cifs/share <password> -W <domain> -u <user> WARNING: The "syslog" option is deprecated... (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

Rsync - how to copy hidden folder or hidden files when using full path

Hello. I use this command : rsync -av --include=".*" --dry-run "$A_FULL_PATH_S" "$A_FULL_PATH_D"The data comes from the output of a find command. And no full source directories are in use, only some files. Source example... (2 Replies)
Discussion started by: jcdole
2 Replies
All times are GMT -4. The time now is 07:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy