Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Base 8 is just like base 10, if you are missing two fingers. -- Tom Lehrer


computers / alt.os.linux / How to set group:owner to all directories created with "mkdir -p" (or other command(s))?

SubjectAuthor
* How to set group:owner to all directories created with "mkdir -p" (or other commBengt T
+- Re: How to set group:owner to all directories created with "mkdir -p" (or other J.O. Aho
`* Re: How to set group:owner to all directories created with "mkdir -p" (or other Paul
 `- Re: How to set group:owner to all directories created with "mkdir -p" (or other Bengt T

1
How to set group:owner to all directories created with "mkdir -p" (or other command(s))?

<7ed03f13-22f6-45ce-9792-836db63561een@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3271&group=alt.os.linux#3271

  copy link   Newsgroups: alt.os.linux
X-Forwarded-Encrypted: i=1; AJvYcCX01i6yXGa8uOlcKr5BZLw1HIe6IzC4IWVW9xZosldaJ/w1iMefqjxnncLeS6HrsDGUbS0A67dOU/Vn8ZmG5K59ZE5S4sQHzcu70Hqh4iun4A==
X-Received: by 2002:ac8:5e0c:0:b0:42d:d78e:ab62 with SMTP id h12-20020ac85e0c000000b0042dd78eab62mr172282qtx.4.1708092244687;
Fri, 16 Feb 2024 06:04:04 -0800 (PST)
X-Forwarded-Encrypted: i=1; AJvYcCUvicU7pbj8xmipVehSOT/5QcoY/m9eD5wSfASSg7QOgXLzpJrcmNY+Of2sb8MicSlxR46ZFas+dS7F8gG0stMKgv7RiQFnT9Q06z9/008=
X-Received: by 2002:a05:6830:442c:b0:6e4:3c99:71d with SMTP id
q44-20020a056830442c00b006e43c99071dmr10163otv.4.1708092244438; Fri, 16 Feb
2024 06:04:04 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.os.linux
Date: Fri, 16 Feb 2024 06:04:04 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=193.181.35.60; posting-account=rPxKYAkAAACZL9Ia3g3cZHelK-_cv8q3
NNTP-Posting-Host: 193.181.35.60
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7ed03f13-22f6-45ce-9792-836db63561een@googlegroups.com>
Subject: How to set group:owner to all directories created with "mkdir -p" (or
other command(s))?
From: bengt_tornqvist@hotmail.com (Bengt T)
Injection-Date: Fri, 16 Feb 2024 14:04:04 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1866
 by: Bengt T - Fri, 16 Feb 2024 14:04 UTC

Suppose that tmp_dir_1, tmp_dir_2 and tmp_dir_3 do not exist. With "mkdir -p tmp_dir_1/tmp_dir_2/tmp_dir_3" the following is created:

!-- tmp_dir_1
.....!-- tmp_dir_2
.........!-- tmp_dir_3

The group:owner of all tmp_dir_...-s are set the group:owner of the user generating the "mkdir..." the command.

How to set group:owner to others, for all tmp_dir_...-s, directly in a script with command(s), without having to manually
do so afterwards?

Re: How to set group:owner to all directories created with "mkdir -p" (or other command(s))?

<l3a1gdFmsbrU1@mid.individual.net>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3274&group=alt.os.linux#3274

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!news.chmurka.net!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: alt.os.linux
Subject: Re: How to set group:owner to all directories created with "mkdir -p"
(or other command(s))?
Date: Fri, 16 Feb 2024 22:13:49 +0100
Lines: 64
Message-ID: <l3a1gdFmsbrU1@mid.individual.net>
References: <7ed03f13-22f6-45ce-9792-836db63561een@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net jSIR/v6Eu61ICx62zul/zARypZC/fntp394BZU+JhWFBYnI8aF
Cancel-Lock: sha1:X9jEP2Jd232jWHoNwcSdNMaBZ1A= sha256:4tjwTL+5xYxR+DWqsQTm6c/eOzoutyoKIQ+Oc2e/YmA=
User-Agent: Mozilla Thunderbird
Content-Language: en-US-large
In-Reply-To: <7ed03f13-22f6-45ce-9792-836db63561een@googlegroups.com>
 by: J.O. Aho - Fri, 16 Feb 2024 21:13 UTC

On 16/02/2024 15.04, Bengt T wrote:
> Suppose that tmp_dir_1, tmp_dir_2 and tmp_dir_3 do not exist. With "mkdir -p tmp_dir_1/tmp_dir_2/tmp_dir_3" the following is created:
>
> !-- tmp_dir_1
> ....!-- tmp_dir_2
> ........!-- tmp_dir_3
>
> The group:owner of all tmp_dir_...-s are set the group:owner of the user generating the "mkdir..." the command.
>
> How to set group:owner to others, for all tmp_dir_...-s, directly in a script with command(s), without having to manually
> do so afterwards?

one liner:

sudo find /path/to/where/the/temp/dirs/are/located -type d -name
"tmp_dir_*" -exec chown user:group "{}" \;

example:

mkdir -p root_dir/tmp_dir_1/{not_temp,tmp_dir_2,tmp_dir_3}/{dir_4,tmp_dir_5}
tree root_dir
### output of tree ###
root_dir/
└── tmp_dir_1
├── not_temp
│   ├── dir_4
│   └── tmp_dir_5
├── tmp_dir_2
│   ├── dir_4
│   └── tmp_dir_5
└── tmp_dir_3
├── dir_4
└── tmp_dir_5

11 directories, 0 files
### end of tree output ###
sudo find root_dir -type d -name "tmp_dir_*" -exec chown user:group "{}" \;

If you want all directories regardless name, then remove the '-name
"tmp_dir_*"' part.
If you want to change all directories and files, then the simple one is just

sudo chown -R user:group root_dir/*

or if you want the root dir to change too

sudo chown -R user:group root_dir

Or you can do:

sudo -u user mkdir -p
root_dir/tmp_dir_1/{not_temp,tmp_dir_2,tmp_dir_3}/{dir_4,tmp_dir_5}

and all the directories are already owned by the user, if the user can
write to the directory where the command is run.

--
//Aho

--
//Aho

Re: How to set group:owner to all directories created with "mkdir -p" (or other command(s))?

<uqors9$2p17$1@dont-email.me>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3275&group=alt.os.linux#3275

  copy link   Newsgroups: alt.os.linux
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nospam@needed.invalid (Paul)
Newsgroups: alt.os.linux
Subject: Re: How to set group:owner to all directories created with "mkdir -p"
(or other command(s))?
Date: Fri, 16 Feb 2024 18:41:59 -0500
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <uqors9$2p17$1@dont-email.me>
References: <7ed03f13-22f6-45ce-9792-836db63561een@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 16 Feb 2024 23:42:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4d58491709ffd82b36cd713c2eab19b6";
logging-data="91175"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Pi0BrScdPMRASEWMSHSk0WWQ9V2QPCkA="
User-Agent: Ratcatcher/2.0.0.25 (Windows/20130802)
Cancel-Lock: sha1:uyDjVDbRKqJKXnE5lSt8eQYIiaY=
In-Reply-To: <7ed03f13-22f6-45ce-9792-836db63561een@googlegroups.com>
Content-Language: en-US
 by: Paul - Fri, 16 Feb 2024 23:41 UTC

On 2/16/2024 9:04 AM, Bengt T wrote:
> Suppose that tmp_dir_1, tmp_dir_2 and tmp_dir_3 do not exist. With "mkdir -p tmp_dir_1/tmp_dir_2/tmp_dir_3" the following is created:
>
> !-- tmp_dir_1
> ....!-- tmp_dir_2
> ........!-- tmp_dir_3
>
> The group:owner of all tmp_dir_...-s are set the group:owner of the user generating the "mkdir..." the command.
>
> How to set group:owner to others, for all tmp_dir_...-s, directly in a script with command(s), without having to manually
> do so afterwards?
>

J.O. Aho has given you the answer.

Here are some one-liner commands from my notes file.

find /media/sample -type d -exec ls -al -1 -d {} + > /mnt/temp/directories.txt
find /media/sample -type f -exec ls -al -1 {} + > /mnt/temp/filelist.txt

Just be careful when crafting material like this, that you do not
accidentally lose access to the area you are working in. Sometimes,
the order you execute a series of one-liners, has consequences.

For an amateur administrator, creating a "sample tree" for practicing
the commands, is a good idea. Then, only the small sample area is
damaged by your mistake. Rather than a large tree of files that
will take a lot of time to correct.

Even how a partition is mounted, matters. It's possible for example,
for a partition to be mounted in such a way, that gratuitous usage
of "sudo" does not work. So the very first thing you do as an
amateur admin, is check how a partition is mounted, the exact command used.
To see if the mount happens to be a "tricky one". An obvious case of a
tricky mount, is a read-only mount, where you won't be changing any
permissions or ownership, any time soon. You can remount rw to fix that.

Paul

Re: How to set group:owner to all directories created with "mkdir -p" (or other command(s))?

<0851e62d-49e6-4a52-923a-5c50adf77da7n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=3277&group=alt.os.linux#3277

  copy link   Newsgroups: alt.os.linux
X-Forwarded-Encrypted: i=1; AJvYcCXM7JPXByHSxMqeLvrj2H4Dv37R5Vtss4D2HGAVPkV2BhfBr+RsG+bfP+KInJCKJfQXBTArtKVkXavMtmtIzCAvmMxeH6p30iv8zXC31wLo9w4=
X-Received: by 2002:a05:6214:e61:b0:686:a6a0:5047 with SMTP id jz1-20020a0562140e6100b00686a6a05047mr388406qvb.4.1708154293241;
Fri, 16 Feb 2024 23:18:13 -0800 (PST)
X-Forwarded-Encrypted: i=1; AJvYcCUnmF34PadjJ347FAYm8Yq42QsNd78/145vPAk5ogzIkC6kBkZJNoNFa+/ejqmc1hSWXrdBIO+oqLlorB+z9zF+X04NFrQsvDHpI7eEA5U=
X-Received: by 2002:a05:6870:568a:b0:21e:6999:31ec with SMTP id
p10-20020a056870568a00b0021e699931ecmr171777oao.0.1708154293004; Fri, 16 Feb
2024 23:18:13 -0800 (PST)
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.os.linux
Date: Fri, 16 Feb 2024 23:18:12 -0800 (PST)
In-Reply-To: <uqors9$2p17$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=45.130.87.2; posting-account=rPxKYAkAAACZL9Ia3g3cZHelK-_cv8q3
NNTP-Posting-Host: 45.130.87.2
References: <7ed03f13-22f6-45ce-9792-836db63561een@googlegroups.com> <uqors9$2p17$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0851e62d-49e6-4a52-923a-5c50adf77da7n@googlegroups.com>
Subject: Re: How to set group:owner to all directories created with "mkdir -p"
(or other command(s))?
From: bengt_tornqvist@hotmail.com (Bengt T)
Injection-Date: Sat, 17 Feb 2024 07:18:13 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Bengt T - Sat, 17 Feb 2024 07:18 UTC

Many thanks for helpful assistance!

It seen to me that the "procedure"
sudo -u user mkdir -p root_dir/tmp_dir_1/{not_temp,tmp_dir_2,tmp_dir_3}/{dir_4,tmp_dir_5}
may suit me.

/Bengt

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor