Changing group & group ownership of file and directory In Linux in hindi

Linux mein, file ya directory ka group aur group ownership change karne ke liye chown aur chgrp commands ka istemal hota hai. Yeh commands aapko flexibility dete hain group ko change karne mein. Main aapko dono commands ke saath kaise group ko change karte hain, woh batata hoon:

Changing group & group ownership of file and directory In Linux in hindi

1. chown Command (Change Owner):
chown command ka istemal file ya directory ke owner aur group ko dono change karne ke liye hota hai. Is command ka syntax is tarah hota hai:

chown [options] [new_owner]:[new_group] [file_or_directory]
  • [new_owner] mein aapko specify karna hota hai ki kaun naya owner hoga.
  • [new_group] mein aapko specify karna hota hai ki kaunsa naya group hoga.
  • [file_or_directory] mein aapko specify karna hota hai ki kis file ya directory ke liye change karna hai.

Example 1:
File ka owner aur group change karna:

chown new_owner:new_group file.txt

Example 2:
Directory ka owner aur group change karna:

chown -R new_owner:new_group directory/

-R option recursive mode mein directory ke contents ko bhi change karega.

2. chgrp Command (Change Group):
chgrp command ka istemal file ya directory ke group ko change karne ke liye hota hai. Is command ka syntax is tarah hota hai:

chgrp [options] new_group [file_or_directory]
  • [new_group] mein aapko specify karna hota hai ki kaunsa naya group hoga.
  • [file_or_directory] mein aapko specify karna hota hai ki kis file ya directory ke liye change karna hai.

Example 3:
File ka group change karna:

chgrp new_group file.txt

Example 4:
Directory ka group change karna:

chgrp -R new_group directory/

-R option recursive mode mein directory ke contents ko bhi change karega.

Permissions aur group ownership ko modify karte waqt, dhyan dein ki aap sirf un files ya directories par permissions aur ownership change karein jinmein aapka appropriate access hai. Aur permissions aur ownership ko secure tarike se manage karein taki aapka system aur data surakshit rahe.

Leave a Comment