I do not recommend it !!!
1) really not safe (especially if you are close to cities - and you need cities to have a station where you can leave trains)
2) not allowed - Italian officials are becoming more and more conservative concerning independent travellers ...
I recommend campsites or hostels: rail.shop/hostelworld