But Trump also took a swipe at the man he had approvingly called "Mad Dog Mattis" when he hired him shortly after winning election in 2016.
"As acting secretary of defence, I now look forward to working with President Trump to carry out his vision alongside strong leaders including the service secretaries, the Joint Chiefs of Staff, the combatant commanders, and senior personnel in the Office of the Secretary of Defense", he had said.
In his Cabinet meeting remarks with reporters present, Trump said he was in no rush to get US troops out of Syria but did not clarify a timetable.
Shanahan became acting secretary of defense on Monday, when retired General James Mattis concluded his final day as defense secretary.
But the retired Marine general actually resigned in protest over Trump's decision to pull US troops from Syria.
The Pentagon's top financial officer David Norquist will soon take over as the acting deputy defense secretary, in succession to Patrick Shanahan, who took over as the acting defense secretary.
"We have some great allies, but a lot of our allies were taking advantage of our taxpayers and our country", Trump said. The US official, who spoke on condition of anonymity, did not elaborate on Shanahan's views on China or what other guidance he gave during the meeting.
"In 2019, the National Defence Strategy remains our guide".
Mattis quit last month after Trump ordered the withdrawal of U.S. troops from Syria, even though the Islamic State still has thousands of fighters in the country and a USA pull out would leave Kurdish fighters vulnerable to attack by Turkey.
Shanahan, 56, did not serve in the military but has worked since July 2017 as the deputy defense secretary.
Relations between the world's two largest economies have plumbed new depths under Trump, with a trade war and disagreements over Taiwan and the South China Sea.
But Trump later announced that Mattis, 68, would be leaving earlier after the defense secretary published a letter that directly criticized the president.
Lt. Col. Joe Buccino, a spokesman for the deputy secretary at the time, told Bloomberg Government on December 21, 2018, that "the Department's legal advisors have a screening process to ensure that Boeing-related issues are not routed to Mr. Shanahan".
At his confirmation hearing to be deputy, the late senator John McCain said a lack of detail in some of Shanahan's foreign policy answers was "almost insulting", and he expressed concerns that putting a former defense executive in the Pentagon could be akin to putting a fox "back in to the henhouse".