View shared files on linux

List of all shared folders

Under this path ( /var/lib/samba/usershares ) only some of my shared folders are available. In other machine there is other folders shown under my machine such as: My Printers, print$ and IPC$ which are not listed in the pass in your answer!

Use this command: smbclient -L localhost . A sample of its output is as follow:

Enter username's password: Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.6-Ubuntu] Sharename Type Comment --------- ---- ------- print$ Disk Printer Drivers IPC$ IPC IPC Service (host-name server (Samba, Ubuntu)) hp1320 Printer Hewlett-Packard hp LaserJet 1320 series HP-LaserJet-1200 Printer HP LaserJet 1200 Public Disk Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.6-Ubuntu] Server Comment --------- ------- host-name server (Samba, Ubuntu) Workgroup Master --------- ------- WORKGROUP HOST-NAME 

Are you trying this on the machine that has the share setup? Else change it to the IP address of the server you are trying to read.

@Lokesh I think Tobias’ coment was meant to be addressed to you. I’d also mention that this specific error usually means that nobody is listening on 139 and 445 port (samba should be listening on at least one of them). You can check if it’s true with ss -an | grep -P «\b(139|445)\b» .

GVFS is the virtual filesystem for the Gnome desktop that allows access to shared drives via SMB, FTP, WebDav, and SFTP. Accessed shares are mounted under ~/.gvfs/ , you can see them there as well.

The command above lists all attached external drives, and network shares, e.g.:

$ gvfs-mount -l Drive(0): 1.5 TB Hard Disk [snip] Mount(0): public on fileserver -> smb://fileserver/public/ Type: GDaemonMount Mount(1): SFTP for bert on server.example.com -> sftp://bert@server.example.com/ Type: GDaemonMount Mount(2): WebDAV as bert on server.example.com -> davs://bert@server.example.com/dav Type: GDaemonMount 

If you add the option -i you get even more information.

Читайте также:  Схема по установке linux

For samba shares we have a set of utilities that come with the samba suite:

smbtree is a smb browser program in text mode. It is similar to the «Network Neighborhood» found on Windows computers. It prints a tree with all the known domains, the servers in those domains and the shares on the servers. Manpage

This is the result for sudo smbstatus —shares : Service pid machine Connected at (nothing in the list).

If you browse your own machine in the Network section of Nautilus, you should see all the shares.

In Nautilus, the is a «Browse Netwrok» Item in the sidebar. Inside it, there is only one item: «Windows Network» and inside it there is only one item: «WORKGROUP». If I double click WORKGROUP it asks me for user name and password and if I enter my user name and password for my Ubuntu, it does not accept it! Can you help?

Hit Alt + Ctrl + T to open terminal and run the following command:

At least two ways to do this:

1. mount

$ mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=1959288k,nr_inodes=489822,mode=755) . # etc, etc 

With no options, mount will list all mounted file systems. Two options are available:

See man mount for details. An example from my system:

$ mount -l -t cifs //NetgearNAS-3/backup on /mnt/NetgearNAS/backup type cifs (rw,relatime,vers=1.0,cache=strict,username=seamus,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.246,soft,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,bsize=1048576,echo_interval=60,actimeo=1) //SynologyNAS-1/backups on /mnt/SynologyNAS/backups type cifs (rw,relatime,vers=3.1.1,cache=strict,username=seamus,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.102,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,user=seamus) 

2. findmnt

findmnt will list all mounted filesystems or search for a filesystem. The findmnt command is able to search in /etc/fstab, /etc/mtab or /proc/self/mountinfo. If device or mountpoint is not given, all filesystems are shown.

With no options, findmnt provides a neat listing of all mounted filesystems in tree format:

$ findmnt TARGET SOURCE FSTYPE OPTIONS / /dev/sda1 ext4 rw,relatime,errors=remount-ro ├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime │ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime │ ├─/sys/fs/cgroup tmpfs tmpfs ro,nosuid,nodev,noexec,mode=755 . # etc, etc 

findmnt has an extensive set of filtering and formatting options, making it well-suited for use in scripts where the output must be parsed — see man findmnt for details. In this case, if we wish to restrict the output to shares (as in the smb/cifs/nfs sense), the -t option is handy:

$ findmnt -t cifs,nfs4 TARGET SOURCE FSTYPE OPTIONS /mnt/SynologyNAS/rpi_share SynologyNAS-1:/volume1/rpi_share nfs4 rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,se /mnt/NetgearNAS-3/backup //NetgearNAS-3/backup cifs rw,relatime,vers=1.0,cache=strict,username=seamus,uid=0,noforceuid,gid=0,noforcegid,addr=192.16 /mnt/SynologyNAS/backups //SynologyNAS-1/backups cifs rw,relatime,vers=3.1.1,cache=strict,username=seamus,uid=0,noforceuid,gid=0,noforcegid,addr=192.168. 

Источник

Читайте также:  Convert doc to pdf on linux

Show NFS shares | List NFS mount points | List NFS clients Linux

In this article I will share multiple commands and method to cover below topics:

  • Show NFS Shares configured on the NFS Server
  • List NFS mount points on the NFS Clients
  • List NFS Clients which are connected to the NFS Server

Show NFS shares on NFS Server

Use showmount to show NFS shares

We can use showmount command to show NFS shares on the NFS Server using NFSv3 protocol.

showmount can be used to show NFS shares only if you are using rpcbind . With NFSv4, rpcbind is not used any more so showmount will throw clnt_create: RPC: Program not registered error on NFSv4 server configuration.

# showmount --exports Export list for server1.example.com: /nfs_shares * /priv_shares 192.168.0.0/255.255.255.0 /pub_shares 10.10.10.0/255.255.255.0

You can also give server details to show NFS shares for the respective server

# showmount --exports 10.10.10.2 Export list for 10.10.10.2: /nfs_shares * /priv_shares 192.168.0.0/255.255.255.0

Use exportfs to show NFS shares

You can use exportfs to show NFS shares with all NFS versions. exportfs -v will show the currently shared directory lists with all the permissions per directory

# exportfs -v /pub_shares 10.10.10.0/255.255.255.0(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash) /priv_shares 192.168.0.0/255.255.255.0(sync,wdelay,hide,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash) /nfs_shares (sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)

Use master export file /var/lib/nfs/etab to show NFS shares

We use /etc/exports or /etc/exports.d to add any NFS share. Next when we refresh the list of shares using exportfs -r or exportfs -a , the shares list from /etc/exports and /etc/exports.d is updated in the master exports table /var/lib/nfs/etab .
WARNING: You should not edit /var/lib/nfs/etab file manually. You must always update shares under /etc/exports and /etc/exports.d

Check the content of /var/lib/nfs/etab to show NFS shares list and all the applied permission details

# cat /var/lib/nfs/etab /priv_shares 192.168.0.0/255.255.255.0(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,ro,secure,root_squash,no_all_squash) /pub_shares 10.10.10.0/255.255.255.0(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,rw,secure,root_squash,no_all_squash) /nfs_shares *(rw,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,rw,secure,no_root_squash,no_all_squash)

List NFS mount points on NFS Clients

There are various commands and methods to list NFS mount points

Use mount to list NFS mount points

We can use mount command to list NFS mount points on nfs-client .

# mount | grep nfs 10.10.10.12:/nfs_shares on /mnt type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.10.10.16,local_lock=none,addr=10.10.10.12)

Use nfsstat to list NFS mount points

Normally we use nfsstat to get the NFS mount point usage and statistics. But we can also use nfsstat to list currently used NFS mount points on nfs-client .

# nfsstat --mounts /mnt from 10.10.10.12:/nfs_shares Flags: rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.10.10.16,local_lock=none,addr=10.10.10.12

Use /proc/mounts to list NFS mount points

We can also check the content of /proc/mounts to list NFS mount points on nfs-client

# cat /proc/mounts | grep nfs 10.10.10.12:/nfs_shares /mnt nfs4 rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.10.10.16,local_lock=none,addr=10.10.10.12 0 0

List NFS clients connected to NFS Server

Use netstat to list NFS clients connected to NFS server

netstat is used to list the listening TCP and UDP ports. In the example I have one NFS client connected to the NFS server on 1018 port

# netstat | grep :nfs tcp 0 0 server1.example.com:nfs 10.10.10.16:1018 ESTABLISHED

Use ss to list NFS clients connected to NFS Server

ss id another utility to investigate sockets and is considered to be a replacement for netstat in future Linux releases. So we can also use ss command to list NFS clients connected to the NFS Server. Execute below command on the NFS server to list NFS clients.

# ss -a|grep :nfs udp UNCONN 0 0 *:nfs *:* udp UNCONN 0 0 [::]:nfs [::]:* tcp LISTEN 0 64 *:nfs *:* tcp ESTAB 0 0 10.10.10.2:nfs 10.10.10.16:1018 tcp LISTEN 0 64 [::]:nfs [::]:*

In this example we have one NFS Client currently connected to the NFS server on port 1018.

Читайте также:  Установка discord kali linux

Lastly I hope the steps from the article to show nfs shares on nfs server, list nfs mount points on nfs clients and list nfs clients connected to nfs server on Linux was helpful. So, let me know your suggestions and feedback using the comment section.

Related Searches: check nfs mount, list nfs shares, showmount command in linux, nfs client list remote exports, list nfs mount points

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

Оцените статью
Adblock
detector