Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Sistemi operativi I > Esercizi da shell
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Cic
.fedelissimo.

User info:
Registered: Jul 2009
Posts: 44 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 16:21:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Esercizi da shell

Ciao ragazzi, qualcuno potrebbe spiegarmi come svolgere gli esercizi sulla shell? Finché si tratta di fare quello sul partizionamento, nessun problema, però non riesco ad eseguire i programmi che richiedono i privilegi di root. Sto usando la iso fornita da Monga sul sito di laboratorio con virtual box. Dove sbaglio?

13-07-2016 11:26
Click Here to See the Profile for Cic Click here to Send Cic a Private Message Find more posts by Cic Add Cic to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Cronovirus
dsy core staff

User info:
Registered: Jun 2012
Posts: 471 (0.11 al dì)
Location:
Corso: Magistrale in Informatica
Anno: 2
Time Online: 4 Days, 2:45:03: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Direi che sarebbe preoccupante il contrario ;) che programma ti serve eseguire?

13-07-2016 12:12
Click Here to See the Profile for Cronovirus Click here to Send Cronovirus a Private Message Find more posts by Cronovirus Add Cronovirus to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Cic
.fedelissimo.

User info:
Registered: Jul 2009
Posts: 44 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 16:21:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Per essere più chiaro, di seguito riporto un esempio del tipo di esercizi ai quali mi riferisco. Presumo debba scrivere il codice con un editor di testo, ma scrivendo sudo gedit mi chiede la password che non conosco. Devono essere fatti in questo modo questi esercizi, oppure ho capito male?

- Specificare l'occupazione totale di un utente in un sistema (somma delle dimensioni dei suoi file...)

#!/bin/sh
if [ $# -ne 1 ]; then
echo "syntax: user_size <user_name>"
exit 1
fi
ID="$(grep "^$1" /etc/passwd | cut -f 3 -d: )"
if [ "$ID" = "" ]; then
echo "User \"${1}\" not found"
exit 1
fi
echo "calculating..."
SUM=0
for ITEM in $(find / -user "$ID" -type f | xargs du | cut -f 1); do
SUM=$(expr ${SUM} + ${ITEM})
done
echo "User \"${1}\" takes ${SUM} KB into the system"
exit 0

Last edited by Cic on 13-07-2016 at 14:57

13-07-2016 14:54
Click Here to See the Profile for Cic Click here to Send Cic a Private Message Find more posts by Cic Add Cic to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Cronovirus
dsy core staff

User info:
Registered: Jun 2012
Posts: 471 (0.11 al dì)
Location:
Corso: Magistrale in Informatica
Anno: 2
Time Online: 4 Days, 2:45:03: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

C'è ancora qualcosa che non è chiaro.. la macchina virtuale è questa? http://homes.di.unimi.it/~sisop/lucidi1516/solab.iso

Se si come fai ad usare gedit senza ambiente grafico? :|

usa vim o vi, se non hai permessi di scrittura sulla home prova su /tmp

in ogni caso.. il tuo script non funzionerebbe comunque dato che accedi a /etc/passwd e per fortuna solo root può farlo. Quindi o chiedi la password di root a monga, oppure cambi soluzione usando find -user ;)

Per quanto riguarda le credenziali per la macchina virtuale sono user: live e la password invece?

13-07-2016 18:27
Click Here to See the Profile for Cronovirus Click here to Send Cronovirus a Private Message Find more posts by Cronovirus Add Cronovirus to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Cic
.fedelissimo.

User info:
Registered: Jul 2009
Posts: 44 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 16:21:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Hai ragione, mi sono accorto dopo che non potevo usare gedit (giustamente) e che gli editor sono quelli da te citati, ma rimane il problema rimane, nel senso che non mi è chiaro come procedere. Per quanto riguarda invece le credenziali di per solab.iso sono user: user, password: live. Solo che io provavo con questa qua http://homes.di.unimi.it/~sisop/luc...solab-esame.iso e come credenziali ho usato user: shell, password: solab.

13-07-2016 19:09
Click Here to See the Profile for Cic Click here to Send Cic a Private Message Find more posts by Cic Add Cic to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Cronovirus
dsy core staff

User info:
Registered: Jun 2012
Posts: 471 (0.11 al dì)
Location:
Corso: Magistrale in Informatica
Anno: 2
Time Online: 4 Days, 2:45:03: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Cic
Hai ragione, mi sono accorto dopo che non potevo usare gedit (giustamente) e che gli editor sono quelli da te citati, ma rimane il problema rimane, nel senso che non mi è chiaro come procedere. Per quanto riguarda invece le credenziali di per solab.iso sono user: user, password: live. Solo che io provavo con questa qua http://homes.di.unimi.it/~sisop/luc...solab-esame.iso e come credenziali ho usato user: shell, password: solab.


crea qualche file in /home/user per esempio e poi lancia

find /home/user/ -user "user" -print0 | du -c --file0-from=- | tail -n 1

13-07-2016 19:57
Click Here to See the Profile for Cronovirus Click here to Send Cronovirus a Private Message Find more posts by Cronovirus Add Cronovirus to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Cic
.fedelissimo.

User info:
Registered: Jul 2009
Posts: 44 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 16:21:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Grazie mille :)

14-07-2016 10:34
Click Here to See the Profile for Cic Click here to Send Cic a Private Message Find more posts by Cic Add Cic to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 16:59.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.033 seconds (84.03% PHP - 15.97% MySQL) con 26 query.