how to access a file which is in other system using linux - linux

how to access a file which is located in another system using Linux?
using Linux commands how can we access a file which is stored in a different system?

To share files between two system on linux ,you can using following methods:
Transferring Files with NFS
Sharing Files with Samba
NFS implementation
To configure the server, proceed as follows:
Prepare the system:
Open a shell, log in as root, and grant write permissions to all users:
mkdir /srv/nfs
chgrp users /srv/nfs
chmod g+w /srv/nfs
Make sure that your user name and user ID is known on the client as well as on the server. Refer to Chapter 8, Managing Users with YaST for detailed instructions about how to create and manage user accounts.
Prepare the NFS server:
Start YaST as root.
Select Network Services+NFS Server (this module is not installed by default. If it is missing in YaST, install the package yast2-nfs-server).
Enable NFS services with Start.
Open the appropriate firewall port with Open Port in Firewall if you are using a firewall.
Export the directories:
Click Add directory and select /srv/nfs.
Set the export options to:
rw,root_squash,async
Repeat these steps, if you need to export more than one directory.
Apply your settings and leave YaST. Your NFS server is ready to use.
To manually start the NFS server, enter rcnfsserver start as root. To stop the server, enter rcnfsserver stop. By default, YaST takes care of starting this service at boot time.
To configure the client, proceed as follows:
Prepare the NFS client:
Start YaST as root.
Select Network Services+NFS Client.
Activate Open Port in Firewall if using a firewall.
Import the remote file system:
Click Add.
Enter the name or IP address of the NFS server or click Choose to automatically scan the network for NFS servers.
Enter the name of your remote file system or automatically choose it with Select.
Enter an appropriate mount point, for example /mnt. If you repeat this step with another exported file system, make sure you choose another mount point than /mnt.
Repeat these steps if you need to import more than one external directory.
Apply your settings and leave YaST. Your NFS client is ready to use.
To start the NFS client manually, enter rcnfs start.
For more details you can refer following link.
http://doc.opensuse.org/documentation/html/openSUSE_113/opensuse-reference/cha.filetrans.html#sec.filetrans.share

Related

Windows Server 2019 "Server for NFS" UID/GID mapping with Auth_SYS

I have a Windows Server 2019 installation with an LDAP instance (nfsmappingstore) for nfs mapping. I created this with the powershell cmdlet Install-NfsMappingStore.
To illustrate, here is a list of the users in that store, and a test of one user:
I have an NFS Share setup as illustrated here:
When I turn on the option circled called "Enable unmapped user access", with the sub-option "Allow unmapped user Unix access (by UID/GID)", then I can go to my uBuntu 18.04 machine and mount that successfully with the command:
sudo mount -t nfs server:/AutoProv mnt
I can then see the files and folders in the share.
However, when I turn that option off, wishing to actually use the mapped user functionality, I get the error:
root#br-dv-ss-l01:/home/steve# mount -vvvv -t nfs server:/AutoProv mnt
mount.nfs: timeout set for Fri Apr 2 18:28:11 2021
mount.nfs: trying text-based options 'vers=4.2,addr=10.200.225.1,clientaddr=10.200.225.104'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4.1,addr=10.200.225.1,clientaddr=10.200.225.104'
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting server:/AutoProv
root#br-dv-ss-l01:/home/steve#
I think this means that the uid/gid was not really sent or interpreted by Windows Server 2019. Looking at the event logs on the server, it seems to indicate that it is happy and reading the LDAP instance OK, and the Test cmdlet gives no errors.
The one possible altered thing I could think to do that seemed to cause a very slightly different effect was to add the "-o nfsvers=3" to the mount command. When I did that, the share did actually mount, but the NFS server refused to let me see anything inside of the share:
Can someone guide me as to how to investigate this issue further? At this time I do not know how to verify what the Windows Server is getting as far as UID/GID, so I really don't know which side of this the issue is on.
Thank you!
Incidentally, we never got any answer on this. LDAP option appears not to work at all. However, the passwd, group file mapping option works great, and we switched to that.
The files have to be named 'group' and 'passwd' lowercase with no extension. They have to be placed in 'C:\Windows\System32\drivers\etc'. Syntax for 'group':
machinename\PodGroup:x:2501:2500,3500
machinename\MyLocalWindowsGroup:x:2502,3500
domain\ACLname:x:2503:0,2500
or generally:
groupname:x:GID:UID1,UID2,etc....
Essentially this is the same mapping that Linux uses as described here: https://www.thegeekdiary.com/etcgroup-file-explained/
So you define a local group on your Windows Server that is running NFS and reference that in the first entry of the line, or use a domain ACL group there. Each 'column' of each line is separated by colons. The second entry 'x' is a description field I think and not used. Third is the GID you want the windows group to be mapped to.
For passwd:
domain\stevesims:x:0:0:Root User,,,:c:\users\stevesims
domain\johndoe:x:2500:2501:Pod User,,,:c:\users\johndoe
domain\janedoe:x:3500:2501:Pod User,,,:C:\users\janedoe
or generally:
username:x:UID:GID:desc,,,:WindowsPathToItsProfile
Once these files are in place on the NFS Server you must restart the NFS Server service or it will not reread the file.
After it is restarted, it will read the file, and if a Linux machine writes a file to the NFS Server, it will be treated as if it has the permissions of the matching Windows account or group from these files.

How can I stream the incoming contents of a file to a remote server?

I'd like to ideally be able to do
echo "1" > file
and that file is being monitored or maybe the file itself is an app that just forwards all contents that's about to be written to another server or source.
Any idea how I can do this or where I should start looking? I tried a few searches online but came up short
Use a network file system like NFS or smbfs or any other network enabled FS. You may consider using FUSE (Filesystem in USErspace) if you don't want to use root account to be able to perform mounts. FUSE also has a bunch of "modules" providing access for different "file-like" network protocols, like sshfs, ftpfs, webdav etc

Subversion (svn) repository on NTFS partition in Linux?

Can I create and use an svn repository on an NTFS partition when working with svn in Linux? That is, repository on the NTFS partition and checkouts and commits to and from an EXT4 partition.
I realize that NTFS support in Linux is limited and does not support permissions and symbolic links for example. Would that, or any other limitations, cause any issues?
The reason I am asking is because I am thinking about either 1) moving my repository to my Dropbox folder (which resides on an NTFS partition) or 2) moving my repository to a memory stick (which could potentially be NTFS partitioned).
My use case is very simple. I am the only person using the repository. Currently my repository resides on EXT4 and I either access it from the same machine as the repository is located on, or from a second machine thorough svn+ssh://. However, if I went with one of the options above, the access strategy would obviously change.
I would be hesitant to do this because, as you stated, NTFS partitions don't support Unix style permissions.
The Subversion repository directory is usually owned and can only be written to by the user who runs whatever Subversion server process is running. For example, if you're using Apache httpd, and you're Apache user is called httpd, the user who owns the repository is httpd and this would be the only user with write permissions on the files and directories.
A NTFS partition on a Windows box does have permissions set correctly because the Subversion server process would use Windows permission settings. A Linux server will have problems.
Also NTFS partitions are case preserving and not case sensitive, I don't know how this would affect the Subversion server process running on a Linux box. Again, a Windows Subversion server process would be fine with this. A Linux server may have problems.
Unfortunately, I can't say for certain one way or another. I've never tried it, nor seen it done. However, there is a post on the Wandisco Forum that covers this very scenario. The user was able to get around his problems, but I would be hesitant to say that all is beer and candy from then on.
Please say you're not doing this, so you can share a file:// protocol Subversion repository among multiple users. This is a big, fat no-no. Instead, you should at least run the svnserve process, and have users accessing your repository via the svn:// protocol. It's very simple to setup svnserve -- even as a Windows service. The only problem may be that port 3620 (The Subversion server port) is being blocked by your firewall or router.
Dropbox multiboot ntfs folder sync.
In an earlier closed thread by vanadium people we're wanting solution to sync Dropbox on multiple boot systems in one ntfs directory. Vanadium had a good suggestion that I tweaked a little bit to solve.
You must install it in Windows or other system and setup Dropbox folder from Dropbox.
Reboot into Linux system. (I used Ubuntu 18)
Install Dropbox to Ext 4 partition.
Open file manager to Home folder and delete Dropbox directory. Leave this file manager open.
Open a new file manager to the main directory ntfs or other that other os Dropbox folder is in.
Hit ctr + h then drag the Dropbox folder to the directory you deleted it from. (This creates a symbol link shortcut to the Dropbox folder you want)
Now sync Dropbox in Linux.
If you want Dropbox to load at startup you must set the partition folder to auto mount on startup in terminal.
1 - Write down the UUID of the drive that you want to mount by executing the following command:
sudo blkid
2 - Then edit the fstab:
sudo gedit /etc/fstab
3 - Add at the end of the file fstab:
UUID=D638F77338F7514B /media/baraldi/win_www ntfs defaults 0 0
Be sure the UUID matches what you recorded in the first step
4 - Restart)
Or Use the "Disks" app.
Load the Disks app (In System) and select the disk with the filesystem you want to mount on startup.
Then select the filesystem on that disk and click on the gears (for configuration).
Select "Edit Mount Options" from the popup menu.
On the setup options, click to check the "Mount on Startup" box. (This will add the entry to fstab when you click on "OK").
Reboot, and your filesystem should be available.
I agree with other comments here regarding manually adding lines to fstab via CLI/text editor. If you take the time to look at your fstab file it will help you understand what changes have been made and, ultimately the CLI method will become faster for you.

Is there any jsch ChannelSftp's function work like command 'cp'

These days,I am work with jsch-0.1.41,operate resources on a remote linux server via ChannelSftp.I find that there is no function provide the functionality similar to shell command "cp".Now I want to copy a file from a directory to the other,these two directory both remote directory on linux server.
Any wrong point in my presentation,please point it out.Thanks.
The SFTP protocol doesn't offer such a command, and thus also JSch's ChannelSftp doesn't offer it.
You have basically two choices:
Use a combination of get and put, i.e. download the file and upload it again. You can do this without local storage (simply connect one of the streams to the other), but this still requires moving the data twice through the network (and encrypting/decrypting twice), where it wouldn't be really necessary. Use this only if the other way doesn't work.
Don't use SFTP, but use an exec channel to execute a copy command on the server. On unix servers, this command is usually named cp, on Windows servers likely copy. (This will not work if the server's administrator somehow limited your account to SFTP-only access.)

SVN Server on NFS3 "Database is locked"

Despite a lots of topics about this error, I'm still having trouble with setting up av SVN Server. Server is running on Scientific Linux 6 and repositories are supposed to be stored via NFS3 on a SUNOS Storage server.
I read that mounting with "nolocks" options would solve the problem but I don't want to do so as a lot of users are working at the same time on the server, I guess removing the locks would create new problems.
SVN is installed, working on local files, but when I try to create a repo on distant location, files are created but I get the error "database is locked" and cannot use the repo. I use the fsfs system which is supposed to work fine with NFS.
Would anyone have another option for me ?
OK I eventually set up a new share on the NFS server, accessible by my SVN server only, mounted there with "nolock". Then it works, but not really the point, I still don't know how to set that up without removing the locks.
An NFS client will normally use the NFS Lock Manager (NLM) to synchronize locking of certain files on the NFS server with other NFS client accessing/locking the same files. The nolock mount option tells the NFS client not to use the NFS Lock Manager but instead to manage the locks locally on the NFS client machine itself. This is useful if you only have 1 NFS client or several NFS clients where each client works on a different area of the exported file system so that there is no lock contention.
It looks like you have the following:
(A) SVN_Client ==> (B) SVN_Server/NFS_Client ==> (C) NFS_Server
Where: Server (B) is Scientific linux 6 providing SVN services to clients and mounting from Server (C), the SunOS Storage Server.
Assuming you have no other machine mounting from the NFS server and providing the same SVN services, the nolock option will work correctly as server(B) will do all the lock management locally. There is no need/requirement to lock centrally on the NFS server.
This is true for NFSv3 which you mentioned in your question.

Resources