CIFS (Common Internet File System) how to mount file from network sharing folder Ubuntu

CIFS stands for Common Internet File System. It's a network file system protocol that allows computers to share files and printers over a network. It's widely used in Windows environments but can also be used on Linux and macOS systems.

 

 

Create a Mount Point:

 

Bash
sudo mkdir /mnt/vbox

 

Mount the Share: Use the following command to mount the share:
Bash
 

sudo mount -t cifs //server_ip_address/share_name /mnt/mount_point -o username=your_username,password=your_password

 

To ensure that files created within a CIFS mount are owned by root, you can use the uid and gid options when mounting the share:

sudo mount -t cifs //server_ip_address/share_name /mnt/mount_point -o username=your_username,password=your_password,uid=0,gid=0

 

uid 0 = user root

gid 0  = group root


To view the UID (user ID) and GID (group ID) of files and directories using the ls command on Ubuntu, you can use the -l option:
Bash

ls -l

Gunakan kode dengan hati-hati.

This will display a long listing of files and directories, including the following information for each:

    Permissions: The file permissions in the format rwxrwxrwx (read, write, execute permissions for owner, group, and others).
    Link count: The number of hard links to the file.
    Owner: The username of the file owner.
    Group: The group name of the file.
    File size: The size of the file in bytes.
    Modification date: The date and time the file was last modified.
    Filename: The name of the file or directory.

To see the numerical UID and GID instead of the usernames and group names, you can use the -n option:
Bash

ls -ln

Gunakan kode dengan hati-hati.

This will display the numerical UID and GID in the owner and group columns, respectively.

Example:

-rw-r--r-- 1 user_name group_name 1024 Nov  6 12:34 file.txt

In this example:

    -rw-r--r--: The file permissions
    1: The number of hard links
    user_name: The owner of the file
    group_name: The group of the file
    1024: The file size in bytes
    Nov 6 12:34: The modification date and time
    file.txt: The filename

If you need more detailed information about a specific file, you can use the stat command:
Bash

stat file.txt

Gunakan kode dengan hati-hati.

This will display a wealth of information about the file, including its inode number, block size, access time, modification time, change time, and more.