[RAILS] [chown] How to change the owner of a file or directory

What is the chown command?

A command to change the ownership of a user or group of files or directories.


$ chown [option]User or group file or directory

How to use

  1. Check the ownership of the user group of the target file.

$ ls -l
#=> -rw-rw-r— 1 sample sample 47 May 21 08:42 test1.htmle.erb
  1. To change user ownership, do the following:

$ chown root test1.htmle.erb

$ ls -l
#=> -rw-rw-r— 1 root samurai 47 May 21 08:42 test1.htmle.erb
  1. If you want to change the ownership of the group, put a semicolon ":" in the argument to make "User: Group".

$ chown root:root test1.htmle.erb

$ ls -l
#=> -rw-rw-r— 1 root root 47 May 21 08:42 test1.htmle.erb

Option list

option Explanation
-c Show details if owner information changes
-f Do not display error message
-h Also change ownership of symbolic links
-R Also change ownership in the directory
-v Display details of owner change information (even if not changed)

Recommended Posts

[chown] How to change the owner of a file or directory
How to change the contents of the jar file without decompressing
How to create a jar file or war file using the jar command
How to find out the Java version of a compiled class file
How to change the value of a variable at a breakpoint in intelliJ
How to get the absolute path of a directory running in Java
[swift5] How to change the color of TabBar or the color of item of TabBar with code
A memo about the types of Java O/R mappers and how to select them
How to save a file with the specified extension under the directory specified in Java to the list
How to change the setting value of Springboot Hikari CP
[Ruby] How to retrieve the contents of a double hash
[jsoup] How to get the full amount of a document
How to change the file name with Xcode (Refactor Rename)
[Rails] How to change the page title of the browser for each page
I made a tool to output the difference of CSV file
How to check for the contents of a java fixed-length string
How to get the length of an audio file in java
[Xcode] How to add a README.md file
[Java] How to use the File class
How to delete the wrong migration file
How to delete the migration file NO FILE
How to determine the number of parallels
[Java] How to get the current directory
How to change the timezone on Ubuntu
Ransack sort_link How to change the color!
The story of forgetting to close a file in Java and failing
How to run a GIF file from the Linux command line (Ubuntu)
How to change the maximum and maximum number of POST data in Spark
[Rails] How to create a table, add a column, and change the column type
Customize how to divide the contents of Recyclerview
Make a margin to the left of the TextField
Set the time of LocalDateTime to a specific time
How to get today's day of the week
Change the timezone of the https-portal container to JST
Output of how to use the slice method
How Microservices Change the Way of Developing Applications
How to display the result of form input
http: // localhost: How to change the port number
[Java] How to get the authority of the folder
[Spring Boot] How to refer to the property file
graphql-ruby: How to get the name of query or mutation in controller Note
How to get the ID of a user authenticated with Firebase in Swift
[Swift] How to change the order of Bar Items in Tab Bar Controller [Beginner]
How to get an arbitrary digit from a number of 2 or more digits! !!
How to make a unique combination of data in the rails intermediate table
How to set environment variables in the properties file of Spring boot application
[Java] How to get the URL of the transition source
How to find the total value, average value, etc. of a two-dimensional array (multidimensional array)-java
How to delete / update the list field of OneToMany
How to run the SpringBoot app as a service
How to jump from Eclipse Java to a SQL file
Access the war file in the root directory of Tomcat
How to write Scala from the perspective of Java
[Java] How to extract the file name from the path
[Ruby] How to find the sum of each digit
[Ruby on Rails] How to change the column name
How to install the root certificate of Centos7 (Cybertrust)
[Java] How to get the maximum value of HashMap
[SwiftUI] How to specify the abbreviated position of Text
JavaFX-Specify the location of the CSS file relative to the fxml file
[ruby] How to assign a value to a hash by referring to the value and key of another hash