snipt

Ctrl+h for KB shortcuts

Bash

Recover the right permissions and owner of files and directories from another similar machine

1
2
3
4
5
6
7
8
# On the right permissions machine
cd /var/
sudo find . -printf "%p %u %g %m\n" > /tmp/var_files.lst
scp /tmp/var_files.lst [email protected]áquina_remota:/tmp/
 
# On the machine we like to recover the permissions
cd /var/
cat /tmp/var_files.lst | while read i ; do a=($i) ; sudo chown -f ${a[1]}:${a[2]} ${a[0]} && sudo chmod ${a[3]} ${a[0]} ; done
https://snipt.net/embed/2454498419e5c981ed063bb942abfdb0/
/raw/2454498419e5c981ed063bb942abfdb0/
2454498419e5c981ed063bb942abfdb0
bash
Bash
8
2019-06-25T12:38:30
True
False
False
/api/public/snipt/21957/
recover-the-right-permissions-and-owner-of-files-and-directories-from-another-similar-machine
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># On the right permissions machine</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">cd</span> /var/ </span><span id="L-3"><a name="L-3"></a>sudo find . -printf <span class="s2">&quot;%p %u %g %m\n&quot;</span> &gt; /tmp/var_files.lst </span><span id="L-4"><a name="L-4"></a>scp /tmp/var_files.lst [email protected]áquina_remota:/tmp/ </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="c1"># On the machine we like to recover the permissions</span> </span><span id="L-7"><a name="L-7"></a><span class="nb">cd</span> /var/ </span><span id="L-8"><a name="L-8"></a>cat /tmp/var_files.lst <span class="p">|</span> <span class="k">while</span> <span class="nb">read</span> i <span class="p">;</span> <span class="k">do</span> <span class="nv">a</span><span class="o">=(</span><span class="nv">$i</span><span class="o">)</span> <span class="p">;</span> sudo chown -f <span class="si">${</span><span class="nv">a</span><span class="p">[1]</span><span class="si">}</span>:<span class="si">${</span><span class="nv">a</span><span class="p">[2]</span><span class="si">}</span> <span class="si">${</span><span class="nv">a</span><span class="p">[0]</span><span class="si">}</span> <span class="o">&amp;&amp;</span> sudo chmod <span class="si">${</span><span class="nv">a</span><span class="p">[3]</span><span class="si">}</span> <span class="si">${</span><span class="nv">a</span><span class="p">[0]</span><span class="si">}</span> <span class="p">;</span> <span class="k">done</span> </span></pre></div> </td></tr></table>
bash, permissions, recover

PHP

recover wordpress url

1
2
3
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://jan.gajdowicz.pl' );
update_option('home', 'http://jan.gajdowicz.pl' );
https://snipt.net/embed/e9c6fc3a3ed4766f8ab977bd6075f027/
/raw/e9c6fc3a3ed4766f8ab977bd6075f027/
e9c6fc3a3ed4766f8ab977bd6075f027
php
PHP
3
2019-06-26T02:52:49
True
False
False
/api/public/snipt/21924/
recover-wordpress-url
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">//FIXME: do comment/remove these hack lines. (once the database is updated)</span> </span><span id="L-2"><a name="L-2"></a><span class="x">update_option(&#39;siteurl&#39;, &#39;http://jan.gajdowicz.pl&#39; );</span> </span><span id="L-3"><a name="L-3"></a><span class="x">update_option(&#39;home&#39;, &#39;http://jan.gajdowicz.pl&#39; );</span> </span></pre></div> </td></tr></table>
recover, url, wp-login