• Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit
Tech News, Magazine & Review WordPress Theme 2017
  • Tech
    Facebook Marketplace And DoorDash Team Up

    Facebook Marketplace And DoorDash Team Up

    How Frustration Over TikTok Has Mounted in Washington

    How Frustration Over TikTok Has Mounted in Washington

    Hundreds Of Employees At TikTok Earlier Worked With Chinese State Media: Report

    300 Employees At TikTok Earlier Worked With Chinese State Media: Report

    Facebook had little choice but to surrender data in Nebraska abortion case

    Facebook had little choice but to surrender data in Nebraska abortion case

    facebook headquarters

    Meta testing stronger Facebook Messenger encryption after abortion case

    Silhouette of smartphone with Facebook, Messenger, whatsApp, Instagram, Oculus apps and blurred META logo on background.

    Meta Aims to Encrypt All Facebook Messenger Chats – Review Geek

    How Trump changed Facebook - Vox

    How Trump changed Facebook – Vox

    Facebook's Message Encryption Was Built to Fail

    Facebook’s Message Encryption Was Built to Fail

    Parents are introducing kids to the original starter Pokémon on TikTok

    Parents are introducing kids to the original starter Pokémon on TikTok

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    The Pixel 6a's OLED Screen Can Be Modded to Run at 90Hz

    The Pixel 6a’s OLED Screen Can Be Modded to Run at 90Hz

    Apple 5W charger

    Apple’s Old 5W iPhone Charger Is Going Away: Here’s Why

    Nest WiFi Label FCC

    New Nest WiFi With WiFi 6E Likely Revealed

    Samsung Odyssey Ark monitor is bigger than a toddler

    Samsung Odyssey Ark monitor is bigger than a toddler

    iPhone 14 Pro Max with iOS 16's always-on display feature imagined in concept renders

    iPhone 14 Pro Max with iOS 16’s always-on display feature imagined in concept renders

    6 Best Monitors (2022): Budget, Ultrawide, 4K, Portable

    6 Best Monitors (2022): Budget, Ultrawide, 4K, Portable

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Apps
    Google Drive logo.

    How to Manage Apps Connected to Your Google Drive

    6 Android Apps for Budget Management

    Samsung Galaxy Z Fold 4: $1,800 Foldable Phone Returns With New Design, Software Tweaks

    8 Types Of Android Apps To Delete Right Away

    8 Types Of Android Apps To Delete Right Away

    Hashtag Trending June 28 – ‘how to move to Canada’ surges in searches; MacBook Pro M2 SSD speed; streaming ‘moochers’ may not pay for a sub

    Hashtag Trending August 12 – Facebook is not popular with teens; misinformation continues to spread; FCC rejects Starlink’s application for $885 million subsidy

    Sloppy Software Patches Are a ‘Disturbing Trend’

    Sloppy Software Patches Are a ‘Disturbing Trend’

    Cyber Security Today for June 29, 2022 — A list of the most dangerous software weaknesses is updated, a warning to Kubernetes administrators, and more

    Cyber Security Today, August 10, 2022 – Bad apps are found in the PyPI repository, six backdoors are used in a gang’s cyber attacks, a new botnet found and more

  • Gaming
    Microsoft finally admits Xbox One sales were less than half of the PS4

    Microsoft finally admits Xbox One sales were less than half of the PS4

    Future of esports in a country economy

    Future of esports in a country economy

    10 Awesome PC Gaming Accessories and Peripherals Worth Getting

    10 Awesome PC Gaming Accessories and Peripherals Worth Getting

    M'sia bags 3 golds at the Commonwealth Esports Championships

    M’sia bags 3 golds at the Commonwealth Esports Championships

    Microsoft Testing PC Game Pass Widget for Windows 11

    Microsoft Testing PC Game Pass Widget for Windows 11

    Genshin Impact game artwork

    10 Best Crossplay Games for Consoles and PC (2022): Xbox, PlayStation, Switch, Mobile

  • Crypto
    Facebook Marketplace And DoorDash Team Up

    Facebook Marketplace And DoorDash Team Up

    How Frustration Over TikTok Has Mounted in Washington

    How Frustration Over TikTok Has Mounted in Washington

    Hundreds Of Employees At TikTok Earlier Worked With Chinese State Media: Report

    300 Employees At TikTok Earlier Worked With Chinese State Media: Report

    Facebook had little choice but to surrender data in Nebraska abortion case

    Facebook had little choice but to surrender data in Nebraska abortion case

    facebook headquarters

    Meta testing stronger Facebook Messenger encryption after abortion case

    Silhouette of smartphone with Facebook, Messenger, whatsApp, Instagram, Oculus apps and blurred META logo on background.

    Meta Aims to Encrypt All Facebook Messenger Chats – Review Geek

    How Trump changed Facebook - Vox

    How Trump changed Facebook – Vox

    Facebook's Message Encryption Was Built to Fail

    Facebook’s Message Encryption Was Built to Fail

    Parents are introducing kids to the original starter Pokémon on TikTok

    Parents are introducing kids to the original starter Pokémon on TikTok

  • Business
    Facebook Marketplace And DoorDash Team Up

    Facebook Marketplace And DoorDash Team Up

    How Frustration Over TikTok Has Mounted in Washington

    How Frustration Over TikTok Has Mounted in Washington

    Hundreds Of Employees At TikTok Earlier Worked With Chinese State Media: Report

    300 Employees At TikTok Earlier Worked With Chinese State Media: Report

    Facebook had little choice but to surrender data in Nebraska abortion case

    Facebook had little choice but to surrender data in Nebraska abortion case

    facebook headquarters

    Meta testing stronger Facebook Messenger encryption after abortion case

    Silhouette of smartphone with Facebook, Messenger, whatsApp, Instagram, Oculus apps and blurred META logo on background.

    Meta Aims to Encrypt All Facebook Messenger Chats – Review Geek

    How Trump changed Facebook - Vox

    How Trump changed Facebook – Vox

    Facebook's Message Encryption Was Built to Fail

    Facebook’s Message Encryption Was Built to Fail

    Parents are introducing kids to the original starter Pokémon on TikTok

    Parents are introducing kids to the original starter Pokémon on TikTok

No Result
View All Result
Geeky Insider
  • Tech
    Facebook Marketplace And DoorDash Team Up

    Facebook Marketplace And DoorDash Team Up

    How Frustration Over TikTok Has Mounted in Washington

    How Frustration Over TikTok Has Mounted in Washington

    Hundreds Of Employees At TikTok Earlier Worked With Chinese State Media: Report

    300 Employees At TikTok Earlier Worked With Chinese State Media: Report

    Facebook had little choice but to surrender data in Nebraska abortion case

    Facebook had little choice but to surrender data in Nebraska abortion case

    facebook headquarters

    Meta testing stronger Facebook Messenger encryption after abortion case

    Silhouette of smartphone with Facebook, Messenger, whatsApp, Instagram, Oculus apps and blurred META logo on background.

    Meta Aims to Encrypt All Facebook Messenger Chats – Review Geek

    How Trump changed Facebook - Vox

    How Trump changed Facebook – Vox

    Facebook's Message Encryption Was Built to Fail

    Facebook’s Message Encryption Was Built to Fail

    Parents are introducing kids to the original starter Pokémon on TikTok

    Parents are introducing kids to the original starter Pokémon on TikTok

  • Gear
    • All
    • Camera
    • Laptop
    • Smartphone
    The Pixel 6a's OLED Screen Can Be Modded to Run at 90Hz

    The Pixel 6a’s OLED Screen Can Be Modded to Run at 90Hz

    Apple 5W charger

    Apple’s Old 5W iPhone Charger Is Going Away: Here’s Why

    Nest WiFi Label FCC

    New Nest WiFi With WiFi 6E Likely Revealed

    Samsung Odyssey Ark monitor is bigger than a toddler

    Samsung Odyssey Ark monitor is bigger than a toddler

    iPhone 14 Pro Max with iOS 16's always-on display feature imagined in concept renders

    iPhone 14 Pro Max with iOS 16’s always-on display feature imagined in concept renders

    6 Best Monitors (2022): Budget, Ultrawide, 4K, Portable

    6 Best Monitors (2022): Budget, Ultrawide, 4K, Portable

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Apps
    Google Drive logo.

    How to Manage Apps Connected to Your Google Drive

    6 Android Apps for Budget Management

    Samsung Galaxy Z Fold 4: $1,800 Foldable Phone Returns With New Design, Software Tweaks

    8 Types Of Android Apps To Delete Right Away

    8 Types Of Android Apps To Delete Right Away

    Hashtag Trending June 28 – ‘how to move to Canada’ surges in searches; MacBook Pro M2 SSD speed; streaming ‘moochers’ may not pay for a sub

    Hashtag Trending August 12 – Facebook is not popular with teens; misinformation continues to spread; FCC rejects Starlink’s application for $885 million subsidy

    Sloppy Software Patches Are a ‘Disturbing Trend’

    Sloppy Software Patches Are a ‘Disturbing Trend’

    Cyber Security Today for June 29, 2022 — A list of the most dangerous software weaknesses is updated, a warning to Kubernetes administrators, and more

    Cyber Security Today, August 10, 2022 – Bad apps are found in the PyPI repository, six backdoors are used in a gang’s cyber attacks, a new botnet found and more

  • Gaming
    Microsoft finally admits Xbox One sales were less than half of the PS4

    Microsoft finally admits Xbox One sales were less than half of the PS4

    Future of esports in a country economy

    Future of esports in a country economy

    10 Awesome PC Gaming Accessories and Peripherals Worth Getting

    10 Awesome PC Gaming Accessories and Peripherals Worth Getting

    M'sia bags 3 golds at the Commonwealth Esports Championships

    M’sia bags 3 golds at the Commonwealth Esports Championships

    Microsoft Testing PC Game Pass Widget for Windows 11

    Microsoft Testing PC Game Pass Widget for Windows 11

    Genshin Impact game artwork

    10 Best Crossplay Games for Consoles and PC (2022): Xbox, PlayStation, Switch, Mobile

  • Crypto
    Facebook Marketplace And DoorDash Team Up

    Facebook Marketplace And DoorDash Team Up

    How Frustration Over TikTok Has Mounted in Washington

    How Frustration Over TikTok Has Mounted in Washington

    Hundreds Of Employees At TikTok Earlier Worked With Chinese State Media: Report

    300 Employees At TikTok Earlier Worked With Chinese State Media: Report

    Facebook had little choice but to surrender data in Nebraska abortion case

    Facebook had little choice but to surrender data in Nebraska abortion case

    facebook headquarters

    Meta testing stronger Facebook Messenger encryption after abortion case

    Silhouette of smartphone with Facebook, Messenger, whatsApp, Instagram, Oculus apps and blurred META logo on background.

    Meta Aims to Encrypt All Facebook Messenger Chats – Review Geek

    How Trump changed Facebook - Vox

    How Trump changed Facebook – Vox

    Facebook's Message Encryption Was Built to Fail

    Facebook’s Message Encryption Was Built to Fail

    Parents are introducing kids to the original starter Pokémon on TikTok

    Parents are introducing kids to the original starter Pokémon on TikTok

  • Business
    Facebook Marketplace And DoorDash Team Up

    Facebook Marketplace And DoorDash Team Up

    How Frustration Over TikTok Has Mounted in Washington

    How Frustration Over TikTok Has Mounted in Washington

    Hundreds Of Employees At TikTok Earlier Worked With Chinese State Media: Report

    300 Employees At TikTok Earlier Worked With Chinese State Media: Report

    Facebook had little choice but to surrender data in Nebraska abortion case

    Facebook had little choice but to surrender data in Nebraska abortion case

    facebook headquarters

    Meta testing stronger Facebook Messenger encryption after abortion case

    Silhouette of smartphone with Facebook, Messenger, whatsApp, Instagram, Oculus apps and blurred META logo on background.

    Meta Aims to Encrypt All Facebook Messenger Chats – Review Geek

    How Trump changed Facebook - Vox

    How Trump changed Facebook – Vox

    Facebook's Message Encryption Was Built to Fail

    Facebook’s Message Encryption Was Built to Fail

    Parents are introducing kids to the original starter Pokémon on TikTok

    Parents are introducing kids to the original starter Pokémon on TikTok

Submit
Geeky Insider
No Result
View All Result

Chown Command in Linux: How to Use It

by Staff Writer
August 5, 2022
in How To
Reading Time: 9 mins read
Chown Command in Linux: How to Use It
Share on FacebookShare on Twitter

READ ALSO

How To Secure Your Remote Company In 2022

How To Secure Your Remote Company In 2022

August 14, 2022
How to keep your information private when seeking an abortion

How to keep your information private when seeking an abortion

August 14, 2022

Managing ownership and file permissions is probably the most essential task of a system administrator. In any multi-user operating system like Linux, properly assigning ownership of files and directories is crucial.

The chown command is the most helpful tool for this. Not to be mistaken with chmod, chown can modify user ownership of files and assign them to different groups. It is an essential command to master for any serious Linux user.

Here is a guide to get you started.

How Do You Check the Ownership of A File?

Before you start shifting files around different owners and groups, you should first learn how to check a file’s current owner. The process is simple: adding a -l flag to a regular ls command includes ownership information of the file or directory queried.

Say you have a file called example.txt. This is how the command to view its ownership information will look like:

ls -l example.txt

Using chown On A Single File

The simplest way to use chown is to change the user owning a particular file. The syntax is sudo chown username filename, where username is the name of the user you want to give the file to, and filename is the name of the file in question. This is what it looks like in practice:

sudo chown someone_else example.txt

Note that this does not change the group ownership of the files, only the user. To change the group owner, you have to use a different syntax – sudo chown :groupname filename

In this specific case, this becomes:

sudo chown :group2 example.txt

You can also combine both commands into a single line to change the user as well as group ownership of a file:

sudo chown me:group1 example.txt

Changing Ownership of Multiple Files With Chown

Changing the ownership of every file individually is rather tedious when dealing with a larger number of files. Thankfully, most Linux commands let you chain together multiple space-separated file names within a single command. Like this:

sudo chown someone_else:group2 example1.txt example2.txt

Use the same trick to check the ownership of multiple files as well:

ls -l example1.txt example2.txt

Even for combining multiple file names into a single command, the process is too inconvenient for more than a couple of files. A better approach is to change the ownership of the entire contents of a directory at once.

This is achieved by adding a -R flag to the chown command. This makes chown go through the directory’s contents and recursively change the ownership of every file inside. Here is a demonstration:

sudo chown -R someone_else:group2 examples

We can use the recursive flag again to check the ownership of the files in the examples folder.

ls -l -R examples

Modify File Ownership With UID

System administrators managing many users will quickly get tired of entering user names repeatedly. A single typo in any of the names throws an error in using chown, slowing things down considerably.

A better alternative is to use the user ID instead. The UID is a four-digit number assigned to each user created, starting from 1000 and going up. This is far easier to enter than a string and much less error-prone.

To use this method, just replace the username with the UID:

sudo chown 1001 example.txt

If you don’t know the UID of a user, you can quickly check it with the id command. Just enter id -u username to see the unique ID of that user.

This method can be extended to group names as well. To get the UID of a user’s login group and other groups they belong to, use the id command without the -u flag.

id someone_else

As you can see, we have various group ids to which the specified user belongs. Putting it all together, we can use chown like this to assign a new owner and change the group of a file:

sudo chown 1001:1003 example.txt

What Else Can You Do With the chown Command?

We have already demonstrated most of the common uses of chown. You can now change users and groups that own a file through various methods. But that’s not the complete limit of the command’s abilities.

You can refer to the official man pages for a technical description and a complete list of arguments you can use with the command. Just enter man chown in the terminal to view it.

Is Chown Useful?

If you are the sole user of your computer, then you will never need to use chown. But if you use a Linux system in a professional setting, be it a commercial server or a university computer, then mastering the chown command (in addition to chmod) is of utmost importance.

The ability to assign and remove files to users and groups is essential in maintaining strict boundaries in multi-user systems. The best part about chown is its flexibility – you can work with individual files or whole directories with the same command.

You can also assign ownership to users and groups separately and in a combined statement. Used with the more convenient UIDs, it makes handling even the most complex user hierarchies a breeze.

Source by helpdeskgeek.com

Related Posts

How to make private photo albums on iPhone and Android
How To

How to make private photo albums on iPhone and Android

August 15, 2022
Cascade Header Image
How To

How to Move a Lost, Off-Screen Window Back to Your Desktop

August 15, 2022
amazon how to open your account page
How To

How to remove and delete a credit card from Amazon

August 14, 2022
Here's how to use Safety Check in iOS 16 to cut ties from an abusive partner
How To

Here’s how to use Safety Check in iOS 16 to cut ties from an abusive partner

August 14, 2022

Recommended.

Silicon Valley is struggling to work together against Trump’s havoc

April 3, 2022
Calendar pages flipping through months. [time / past / future / history / what

Tech event calendar 2022: Upcoming US shows, conferences, and IT expos

July 12, 2022

Trending.

graduate student school college certification it career data scientist

Companies move to drop college degree requirements for new hires, focus on skills

August 10, 2022
SFI’s Insight partners with Cadence to use quantum computing in chip design

SFI’s Insight partners with Cadence to use quantum computing in chip design

July 15, 2022
Facebook considering allowing 5 profiles per account #1612

Facebook considering allowing 5 profiles per account #1612

July 15, 2022
VPN logo on a laptop PC and smartphone.

How to Choose the Best VPN Service for Your Needs

July 27, 2022
what is API Testing

10 Best API Testing Tools to Use in 2022

July 11, 2022
Geeky Insider

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Categories

  • Android
  • Apple
  • Apps and softwares
  • Articles
  • Business
  • Camera
  • Crypto
  • Education
  • Entertainment
  • Gadget and Gear
  • Gaming
  • How To
  • Laptop
  • Marketing
  • Microsoft
  • Review
  • Security
  • Smartphone
  • Technology

Submit a Techy Post | Write For Us

Feel free to contact us for submission queries. via contact form or email us at [email protected].

  • Home
  • About
  • Contact
  • Privacy
  • Terms
  • DCMA
  • Write For Us / Submit

© 2022 GeekyInsider.com

No Result
View All Result
  • Home
  • Review
  • Apple
  • Apps and softwares
  • Gaming
  • Gadget and Gear
    • Camera
    • Smartphone
  • Microsoft
  • Security